How to change margins for a table defined in tabularx environment?
up vote
1
down vote
favorite
I would like to move my table
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
end{document}
to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?
margins tabularx leftmargin
add a comment |
up vote
1
down vote
favorite
I would like to move my table
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
end{document}
to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?
margins tabularx leftmargin
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I would like to move my table
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
end{document}
to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?
margins tabularx leftmargin
I would like to move my table
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
end{document}
to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?
margins tabularx leftmargin
margins tabularx leftmargin
edited yesterday
asked yesterday
Roloka
285
285
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Try the following, based on this answer by David Carlisle:
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
section{Text before with original margins}
some text here
setlengthLTleft{-2cm} % adjust these to your liking
setlengthLTright{-2cm}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
noindent More text with original margins
end{document}
Which gives the following output:
Thank you, nice solution! :)
– Roloka
yesterday
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
add a comment |
up vote
5
down vote
- do you really need table over more than one page?
- using
tabularx
at least one column had to be of typeX
- using standard
tabular*
fit table in text area:
(red lines indicate border of text area)
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
% usepackage{ltablex}
begin{document}
begin{table}[htb]
setlengthtabcolsep{0pt}
caption{Numbers}
noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabular*}
end{table}
end{document}
solution as you ask in question, i.e. considering ltablex
and expand text width locally (however, table should not be longer than one page):
(red lines indicate border of page layout)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
usepackage[strict]{changepage}
begin{document}
begin{adjustwidth*}{}{-1.5cm}
setlengthtabcolsep{3pt}
begin{tabularx}{linewidth}{*{24}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
end{tabularx}
end{adjustwidth*}
end{document}
addendum:
from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...
if you like to have table width equal to text width, and for table use tabularx
redefined by ltablex
environment for equal width cells, than you need to make two changes in your mwe:
- replace
c
column specifiers withX
in preamble add command
keepXColumns
, which will assure thatX
columns will behave the same as at standardtabularx
(do you aware that usingltablex
change standard features oftabularx
?)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
begin{document}
begin{tabularx}{linewidth}{*{9}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
end{tabularx}
end{document}
(red lines indicate border of page layout)
is this what you looking for?
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Try the following, based on this answer by David Carlisle:
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
section{Text before with original margins}
some text here
setlengthLTleft{-2cm} % adjust these to your liking
setlengthLTright{-2cm}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
noindent More text with original margins
end{document}
Which gives the following output:
Thank you, nice solution! :)
– Roloka
yesterday
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
add a comment |
up vote
4
down vote
accepted
Try the following, based on this answer by David Carlisle:
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
section{Text before with original margins}
some text here
setlengthLTleft{-2cm} % adjust these to your liking
setlengthLTright{-2cm}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
noindent More text with original margins
end{document}
Which gives the following output:
Thank you, nice solution! :)
– Roloka
yesterday
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Try the following, based on this answer by David Carlisle:
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
section{Text before with original margins}
some text here
setlengthLTleft{-2cm} % adjust these to your liking
setlengthLTright{-2cm}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
noindent More text with original margins
end{document}
Which gives the following output:
Try the following, based on this answer by David Carlisle:
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
begin{document}
section{Text before with original margins}
some text here
setlengthLTleft{-2cm} % adjust these to your liking
setlengthLTright{-2cm}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}
noindent More text with original margins
end{document}
Which gives the following output:
edited yesterday
answered yesterday
chrisma
777416
777416
Thank you, nice solution! :)
– Roloka
yesterday
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
add a comment |
Thank you, nice solution! :)
– Roloka
yesterday
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
Thank you, nice solution! :)
– Roloka
yesterday
Thank you, nice solution! :)
– Roloka
yesterday
2
2
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
Glad it helped. Would you like to accept an answer?
– chrisma
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
– Roloka
yesterday
add a comment |
up vote
5
down vote
- do you really need table over more than one page?
- using
tabularx
at least one column had to be of typeX
- using standard
tabular*
fit table in text area:
(red lines indicate border of text area)
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
% usepackage{ltablex}
begin{document}
begin{table}[htb]
setlengthtabcolsep{0pt}
caption{Numbers}
noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabular*}
end{table}
end{document}
solution as you ask in question, i.e. considering ltablex
and expand text width locally (however, table should not be longer than one page):
(red lines indicate border of page layout)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
usepackage[strict]{changepage}
begin{document}
begin{adjustwidth*}{}{-1.5cm}
setlengthtabcolsep{3pt}
begin{tabularx}{linewidth}{*{24}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
end{tabularx}
end{adjustwidth*}
end{document}
addendum:
from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...
if you like to have table width equal to text width, and for table use tabularx
redefined by ltablex
environment for equal width cells, than you need to make two changes in your mwe:
- replace
c
column specifiers withX
in preamble add command
keepXColumns
, which will assure thatX
columns will behave the same as at standardtabularx
(do you aware that usingltablex
change standard features oftabularx
?)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
begin{document}
begin{tabularx}{linewidth}{*{9}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
end{tabularx}
end{document}
(red lines indicate border of page layout)
is this what you looking for?
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
add a comment |
up vote
5
down vote
- do you really need table over more than one page?
- using
tabularx
at least one column had to be of typeX
- using standard
tabular*
fit table in text area:
(red lines indicate border of text area)
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
% usepackage{ltablex}
begin{document}
begin{table}[htb]
setlengthtabcolsep{0pt}
caption{Numbers}
noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabular*}
end{table}
end{document}
solution as you ask in question, i.e. considering ltablex
and expand text width locally (however, table should not be longer than one page):
(red lines indicate border of page layout)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
usepackage[strict]{changepage}
begin{document}
begin{adjustwidth*}{}{-1.5cm}
setlengthtabcolsep{3pt}
begin{tabularx}{linewidth}{*{24}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
end{tabularx}
end{adjustwidth*}
end{document}
addendum:
from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...
if you like to have table width equal to text width, and for table use tabularx
redefined by ltablex
environment for equal width cells, than you need to make two changes in your mwe:
- replace
c
column specifiers withX
in preamble add command
keepXColumns
, which will assure thatX
columns will behave the same as at standardtabularx
(do you aware that usingltablex
change standard features oftabularx
?)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
begin{document}
begin{tabularx}{linewidth}{*{9}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
end{tabularx}
end{document}
(red lines indicate border of page layout)
is this what you looking for?
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
add a comment |
up vote
5
down vote
up vote
5
down vote
- do you really need table over more than one page?
- using
tabularx
at least one column had to be of typeX
- using standard
tabular*
fit table in text area:
(red lines indicate border of text area)
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
% usepackage{ltablex}
begin{document}
begin{table}[htb]
setlengthtabcolsep{0pt}
caption{Numbers}
noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabular*}
end{table}
end{document}
solution as you ask in question, i.e. considering ltablex
and expand text width locally (however, table should not be longer than one page):
(red lines indicate border of page layout)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
usepackage[strict]{changepage}
begin{document}
begin{adjustwidth*}{}{-1.5cm}
setlengthtabcolsep{3pt}
begin{tabularx}{linewidth}{*{24}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
end{tabularx}
end{adjustwidth*}
end{document}
addendum:
from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...
if you like to have table width equal to text width, and for table use tabularx
redefined by ltablex
environment for equal width cells, than you need to make two changes in your mwe:
- replace
c
column specifiers withX
in preamble add command
keepXColumns
, which will assure thatX
columns will behave the same as at standardtabularx
(do you aware that usingltablex
change standard features oftabularx
?)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
begin{document}
begin{tabularx}{linewidth}{*{9}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
end{tabularx}
end{document}
(red lines indicate border of page layout)
is this what you looking for?
- do you really need table over more than one page?
- using
tabularx
at least one column had to be of typeX
- using standard
tabular*
fit table in text area:
(red lines indicate border of text area)
documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
% usepackage{ltablex}
begin{document}
begin{table}[htb]
setlengthtabcolsep{0pt}
caption{Numbers}
noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabular*}
end{table}
end{document}
solution as you ask in question, i.e. considering ltablex
and expand text width locally (however, table should not be longer than one page):
(red lines indicate border of page layout)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
usepackage[strict]{changepage}
begin{document}
begin{adjustwidth*}{}{-1.5cm}
setlengthtabcolsep{3pt}
begin{tabularx}{linewidth}{*{24}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
end{tabularx}
end{adjustwidth*}
end{document}
addendum:
from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...
if you like to have table width equal to text width, and for table use tabularx
redefined by ltablex
environment for equal width cells, than you need to make two changes in your mwe:
- replace
c
column specifiers withX
in preamble add command
keepXColumns
, which will assure thatX
columns will behave the same as at standardtabularx
(do you aware that usingltablex
change standard features oftabularx
?)
documentclass[a4paper, 12pt]{article}
usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}
keepXColumns
begin{document}
begin{tabularx}{linewidth}{*{9}{X} }
caption{Numbers} \
hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
end{tabularx}
end{document}
(red lines indicate border of page layout)
is this what you looking for?
edited yesterday
answered yesterday
Zarko
118k865155
118k865155
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
add a comment |
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
Yes, I need a table containing 200 rows and 9 wide columns.
– Roloka
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
– Zarko
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
@Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
– Mico
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
– Roloka
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
@Roloka, see addendum to my answer.
– Zarko
yesterday
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463134%2fhow-to-change-margins-for-a-table-defined-in-tabularx-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown