everytime i try the table goes out of the page.
Asked
Active
Viewed 52 times
0
Phelype Oleinik
- 70,814
Råhül Ràvi
- 11
1 Answers
2
As skeleton for your table. Real text in cells you should write yourself (with it replace \lipsum*[66] which generate dummy text):
\documentclass[12pt,a4paper]{article}
\usepackage{tabularx}
\usepackage{lipsum} % for dummy text
\begin{document}
\begin{table}[ht] % <---
\begin{tabularx}{\linewidth}{|l|*{3}{>{\raggedright\arraybackslash}X|}}
\hline
1 & \lipsum*[66] & \lipsum*[66] & \lipsum*[66] \\
\hline
2 & \lipsum*[66] & \lipsum*[66] & \lipsum*[66] \\
\hline
\end{tabularx}
\end{table}
\end{document}
If you like to have more vertical space above/below in table cells, then you can do this by help of makecell package:
\documentclass[12pt,a4paper]{article}
\usepackage{makecell, tabularx}
\setcellgapes{3pt}
\usepackage{lipsum}
\begin{document}
\begin{table}
\makegapedcells
\begin{tabularx}{\linewidth}{|l|*{3}{>{\raggedright\arraybackslash}X|}}
\hline
1 & \lipsum*[66] & \lipsum*[66] & \lipsum*[66] \\
\hline
2 & \lipsum*[66] & \lipsum*[66] & \lipsum*[66] \\
\hline
\end{tabularx}
\end{table}
\end{document}
Zarko
- 296,517
-
ok but how will i edit the text in between and i need 5 columns u have only three?? – Råhül Ràvi Oct 01 '19 at 18:19
-
@RåhülRàvi, in place where is now
\lipsum*[66]you should write your text. See edited answer. – Zarko Oct 01 '19 at 18:22 -
thankyou ! it worked out but the table is aligned to bottom of the page. i want to make it to the top ? – Råhül Ràvi Oct 01 '19 at 18:30
-
1@RåhülRàvi, I didn't add table placement (now is added:
\begin{table}[ht]). I suggest you to read some introductory text about table and float environments, for example: https://en.wikibooks.org/wiki/LaTeX/Tables and https://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat/39020#39020 respectively – Zarko Oct 01 '19 at 18:36 -
whatever value of height i gave it is coming in the next page. could you specify the [ht] value so the table comes below LITERATURE SURVEY heading? – Råhül Ràvi Oct 01 '19 at 18:59
-
1@RåhülRàvi, I'm very sorry, I don't understood what is your problem (my cristal ball is broken :-( ). I suggest you to edit your question and add missed information in form of small but complete document (for example based on on my answer) or better ask new question in which you should provide all relevant information. Preparing it, please read introductory text about tables for which I give you line in previous comment. Now I can only guess, that you actually look for table which can span over multiple page. – Zarko Oct 01 '19 at 19:23



left-aligned columns in your column specification for the table.l-columns don't wrap. For that you'd need ap{<len>}column, or perhaps atabularxenvironment seems more appropriate in your case; that is the second case discussed in My table doesn't fit; what are my options? (possible duplicate). – Werner Oct 01 '19 at 17:38