How can I center a too wide table?
I have a document containing a table which is slightly too wide for the page. But instead of growing to the right side only, I would like to have it centered on the page.
I have tried to use the center
environment but this doesn't seem to help.
tables horizontal-alignment
|
show 2 more comments
I have a document containing a table which is slightly too wide for the page. But instead of growing to the right side only, I would like to have it centered on the page.
I have tried to use the center
environment but this doesn't seem to help.
tables horizontal-alignment
4
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including thedocumentclass
and the appropriate packages so that those trying to help don't have to recreate it.
– Peter Grill
Dec 27 '11 at 16:30
1
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
1
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02
|
show 2 more comments
I have a document containing a table which is slightly too wide for the page. But instead of growing to the right side only, I would like to have it centered on the page.
I have tried to use the center
environment but this doesn't seem to help.
tables horizontal-alignment
I have a document containing a table which is slightly too wide for the page. But instead of growing to the right side only, I would like to have it centered on the page.
I have tried to use the center
environment but this doesn't seem to help.
tables horizontal-alignment
tables horizontal-alignment
edited Dec 27 '11 at 16:55
Martin Scharrer♦
200k45636818
200k45636818
asked Dec 27 '11 at 16:25
DejanDejan
5921410
5921410
4
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including thedocumentclass
and the appropriate packages so that those trying to help don't have to recreate it.
– Peter Grill
Dec 27 '11 at 16:30
1
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
1
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02
|
show 2 more comments
4
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including thedocumentclass
and the appropriate packages so that those trying to help don't have to recreate it.
– Peter Grill
Dec 27 '11 at 16:30
1
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
1
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02
4
4
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including the
documentclass
and the appropriate packages so that those trying to help don't have to recreate it.– Peter Grill
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including the
documentclass
and the appropriate packages so that those trying to help don't have to recreate it.– Peter Grill
Dec 27 '11 at 16:30
1
1
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
1
1
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02
|
show 2 more comments
3 Answers
3
active
oldest
votes
If a table (or any other horizontal box) is wider than the text (textwidth
) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than textwidth
. The makebox
macro with its two optional argument for the width and horizontal alignment can be used for this: makebox[textwidth][c]{<table>}
will center the content. See Center figure that is wider than textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.
For more complicated tables, especially if they should contain verbatim material, you should use a different approach. makebox
reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The Makebox
macro or the Makebox
environment from the realboxes
can be used as an replacement. It reads the content as a box. Better would be the adjustbox
macro or environment from the adjustbox
package together with the center
key.
begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
end{adjustbox}
Which centers the content to linewidth
(mostly identical to textwidth
) by default but also takes any other length as an optional value, e.g. center=10cm
. Note that <your table>
should be a tabular
or equivalent environment, not a table
environment.
You can now also use the tabular
key of adjustbox
(as first key!) to save the extra begin{tabular}
.. end{tabular}
which is then added internally.
begin{adjustbox}{tabular=lll,center}
a & b & c \
a & b & c \
a & b & c \
end{adjustbox}
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
@Dejan:centerline
reads the content as a macro argument as well and is basically the same asmakebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, butmakebox
oradjustbox
is more flexible.
– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.Not in outer par mode
It refers to mybegin{table}
code
– Whitecat
Nov 17 '15 at 17:36
11
I found out the problem isbegin{adjustbox}{center}
should go just beforebegin{tabular}{ll|l}
notbegin{table}
The answer should be adjusted, as it is not clear what<your table>
means.
– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer aboutMakebox
andmakebox
or really why it's important to know... But I will say that theadjustbox
trick works great!
– Benjamin Mako Hill
Jun 14 '17 at 18:08
|
show 2 more comments
Put your table into centerline{}
. The table will extend evenly into both margins if it's wider than textwidth
.
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
add a comment |
I’ve seen that an answer based on the use of centerline
has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:
% My standard header for TeX.SX answers:
documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
usepackage{mwe} % facilitates the writing of Minimale Working Examples like
% this one, not to be used in actual documents
begin{document}
lipsum[1]
begin{center}
addtolength{leftskip} {-2cm} % increase (absolute) value if needed
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
Does & this & table \
really & need & to \
be & so & wide? \
hline
end{tabular*}
end{center}
It works with floating objects, too: see, for example, figure~ref{fig:a} and
table~ref{tab:b}.
begin{figure}[tbp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
includegraphics[width=1.2textwidth,height=5cm]{image}
caption{A example image}
label{fig:a}
end{figure}
begin{table}[bp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
And & what & about \
this & one, & eh? \
hline
end{tabular*}
caption{An example table}
label{tab:b}
end{table}
lipsum[2]
end{document}
This is the output:
addtolength{leftskip}{-2cm}
andaddtolength{rightskip}{-2cm}
seems a cleaner solution to me.
– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solutionaddtolength...
seems cleaner than the others", although it is much less voted.
– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f39435%2fhow-can-i-center-a-too-wide-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
If a table (or any other horizontal box) is wider than the text (textwidth
) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than textwidth
. The makebox
macro with its two optional argument for the width and horizontal alignment can be used for this: makebox[textwidth][c]{<table>}
will center the content. See Center figure that is wider than textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.
For more complicated tables, especially if they should contain verbatim material, you should use a different approach. makebox
reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The Makebox
macro or the Makebox
environment from the realboxes
can be used as an replacement. It reads the content as a box. Better would be the adjustbox
macro or environment from the adjustbox
package together with the center
key.
begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
end{adjustbox}
Which centers the content to linewidth
(mostly identical to textwidth
) by default but also takes any other length as an optional value, e.g. center=10cm
. Note that <your table>
should be a tabular
or equivalent environment, not a table
environment.
You can now also use the tabular
key of adjustbox
(as first key!) to save the extra begin{tabular}
.. end{tabular}
which is then added internally.
begin{adjustbox}{tabular=lll,center}
a & b & c \
a & b & c \
a & b & c \
end{adjustbox}
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
@Dejan:centerline
reads the content as a macro argument as well and is basically the same asmakebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, butmakebox
oradjustbox
is more flexible.
– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.Not in outer par mode
It refers to mybegin{table}
code
– Whitecat
Nov 17 '15 at 17:36
11
I found out the problem isbegin{adjustbox}{center}
should go just beforebegin{tabular}{ll|l}
notbegin{table}
The answer should be adjusted, as it is not clear what<your table>
means.
– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer aboutMakebox
andmakebox
or really why it's important to know... But I will say that theadjustbox
trick works great!
– Benjamin Mako Hill
Jun 14 '17 at 18:08
|
show 2 more comments
If a table (or any other horizontal box) is wider than the text (textwidth
) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than textwidth
. The makebox
macro with its two optional argument for the width and horizontal alignment can be used for this: makebox[textwidth][c]{<table>}
will center the content. See Center figure that is wider than textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.
For more complicated tables, especially if they should contain verbatim material, you should use a different approach. makebox
reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The Makebox
macro or the Makebox
environment from the realboxes
can be used as an replacement. It reads the content as a box. Better would be the adjustbox
macro or environment from the adjustbox
package together with the center
key.
begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
end{adjustbox}
Which centers the content to linewidth
(mostly identical to textwidth
) by default but also takes any other length as an optional value, e.g. center=10cm
. Note that <your table>
should be a tabular
or equivalent environment, not a table
environment.
You can now also use the tabular
key of adjustbox
(as first key!) to save the extra begin{tabular}
.. end{tabular}
which is then added internally.
begin{adjustbox}{tabular=lll,center}
a & b & c \
a & b & c \
a & b & c \
end{adjustbox}
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
@Dejan:centerline
reads the content as a macro argument as well and is basically the same asmakebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, butmakebox
oradjustbox
is more flexible.
– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.Not in outer par mode
It refers to mybegin{table}
code
– Whitecat
Nov 17 '15 at 17:36
11
I found out the problem isbegin{adjustbox}{center}
should go just beforebegin{tabular}{ll|l}
notbegin{table}
The answer should be adjusted, as it is not clear what<your table>
means.
– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer aboutMakebox
andmakebox
or really why it's important to know... But I will say that theadjustbox
trick works great!
– Benjamin Mako Hill
Jun 14 '17 at 18:08
|
show 2 more comments
If a table (or any other horizontal box) is wider than the text (textwidth
) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than textwidth
. The makebox
macro with its two optional argument for the width and horizontal alignment can be used for this: makebox[textwidth][c]{<table>}
will center the content. See Center figure that is wider than textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.
For more complicated tables, especially if they should contain verbatim material, you should use a different approach. makebox
reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The Makebox
macro or the Makebox
environment from the realboxes
can be used as an replacement. It reads the content as a box. Better would be the adjustbox
macro or environment from the adjustbox
package together with the center
key.
begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
end{adjustbox}
Which centers the content to linewidth
(mostly identical to textwidth
) by default but also takes any other length as an optional value, e.g. center=10cm
. Note that <your table>
should be a tabular
or equivalent environment, not a table
environment.
You can now also use the tabular
key of adjustbox
(as first key!) to save the extra begin{tabular}
.. end{tabular}
which is then added internally.
begin{adjustbox}{tabular=lll,center}
a & b & c \
a & b & c \
a & b & c \
end{adjustbox}
If a table (or any other horizontal box) is wider than the text (textwidth
) an overfull hbox warning is given and the content is placed anyway, which makes it run into the right margin. To avoid this and to suppress the error the content must be placed in a box with is equal or smaller than textwidth
. The makebox
macro with its two optional argument for the width and horizontal alignment can be used for this: makebox[textwidth][c]{<table>}
will center the content. See Center figure that is wider than textwidth and Place figures side by side, spill into outer margin were this is used for figures and further explained.
For more complicated tables, especially if they should contain verbatim material, you should use a different approach. makebox
reads the whole content as macro argument which does not allow verbatim content and is not very efficient (ok, nowadays the latter isn't really important any longer). The Makebox
macro or the Makebox
environment from the realboxes
can be used as an replacement. It reads the content as a box. Better would be the adjustbox
macro or environment from the adjustbox
package together with the center
key.
begin{adjustbox}{center}
<your table (i.e. the tabular or similar environment)>
end{adjustbox}
Which centers the content to linewidth
(mostly identical to textwidth
) by default but also takes any other length as an optional value, e.g. center=10cm
. Note that <your table>
should be a tabular
or equivalent environment, not a table
environment.
You can now also use the tabular
key of adjustbox
(as first key!) to save the extra begin{tabular}
.. end{tabular}
which is then added internally.
begin{adjustbox}{tabular=lll,center}
a & b & c \
a & b & c \
a & b & c \
end{adjustbox}
edited Jan 17 at 16:37
answered Dec 27 '11 at 16:52
Martin Scharrer♦Martin Scharrer
200k45636818
200k45636818
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
@Dejan:centerline
reads the content as a macro argument as well and is basically the same asmakebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, butmakebox
oradjustbox
is more flexible.
– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.Not in outer par mode
It refers to mybegin{table}
code
– Whitecat
Nov 17 '15 at 17:36
11
I found out the problem isbegin{adjustbox}{center}
should go just beforebegin{tabular}{ll|l}
notbegin{table}
The answer should be adjusted, as it is not clear what<your table>
means.
– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer aboutMakebox
andmakebox
or really why it's important to know... But I will say that theadjustbox
trick works great!
– Benjamin Mako Hill
Jun 14 '17 at 18:08
|
show 2 more comments
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
@Dejan:centerline
reads the content as a macro argument as well and is basically the same asmakebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, butmakebox
oradjustbox
is more flexible.
– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.Not in outer par mode
It refers to mybegin{table}
code
– Whitecat
Nov 17 '15 at 17:36
11
I found out the problem isbegin{adjustbox}{center}
should go just beforebegin{tabular}{ll|l}
notbegin{table}
The answer should be adjusted, as it is not clear what<your table>
means.
– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer aboutMakebox
andmakebox
or really why it's important to know... But I will say that theadjustbox
trick works great!
– Benjamin Mako Hill
Jun 14 '17 at 18:08
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
Thank you very much for the detailed explanation. Why not use centerline{} as suggested in another answer? Are you aware of any drawbacks?
– Dejan
Dec 28 '11 at 5:51
2
2
@Dejan:
centerline
reads the content as a macro argument as well and is basically the same as makebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, but makebox
or adjustbox
is more flexible.– Martin Scharrer♦
Dec 28 '11 at 8:52
@Dejan:
centerline
reads the content as a macro argument as well and is basically the same as makebox[hsize][c]
, using more lower-level TeX commands than LaTeX ones. It will work, but makebox
or adjustbox
is more flexible.– Martin Scharrer♦
Dec 28 '11 at 8:52
I don't know how to get this solution to work. I use adjustbox but it throwing error.
Not in outer par mode
It refers to my begin{table}
code– Whitecat
Nov 17 '15 at 17:36
I don't know how to get this solution to work. I use adjustbox but it throwing error.
Not in outer par mode
It refers to my begin{table}
code– Whitecat
Nov 17 '15 at 17:36
11
11
I found out the problem is
begin{adjustbox}{center}
should go just before begin{tabular}{ll|l}
not begin{table}
The answer should be adjusted, as it is not clear what <your table>
means.– Whitecat
Nov 17 '15 at 17:42
I found out the problem is
begin{adjustbox}{center}
should go just before begin{tabular}{ll|l}
not begin{table}
The answer should be adjusted, as it is not clear what <your table>
means.– Whitecat
Nov 17 '15 at 17:42
I don't understand the whole first half of this answer about
Makebox
and makebox
or really why it's important to know... But I will say that the adjustbox
trick works great!– Benjamin Mako Hill
Jun 14 '17 at 18:08
I don't understand the whole first half of this answer about
Makebox
and makebox
or really why it's important to know... But I will say that the adjustbox
trick works great!– Benjamin Mako Hill
Jun 14 '17 at 18:08
|
show 2 more comments
Put your table into centerline{}
. The table will extend evenly into both margins if it's wider than textwidth
.
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
add a comment |
Put your table into centerline{}
. The table will extend evenly into both margins if it's wider than textwidth
.
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
add a comment |
Put your table into centerline{}
. The table will extend evenly into both margins if it's wider than textwidth
.
Put your table into centerline{}
. The table will extend evenly into both margins if it's wider than textwidth
.
answered Dec 27 '11 at 17:34
Martin SchröderMartin Schröder
12.8k639123
12.8k639123
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
add a comment |
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
1
1
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
This works great as long as there is no new lines between centerline and the table.
– fotanus
Aug 7 '15 at 15:44
add a comment |
I’ve seen that an answer based on the use of centerline
has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:
% My standard header for TeX.SX answers:
documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
usepackage{mwe} % facilitates the writing of Minimale Working Examples like
% this one, not to be used in actual documents
begin{document}
lipsum[1]
begin{center}
addtolength{leftskip} {-2cm} % increase (absolute) value if needed
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
Does & this & table \
really & need & to \
be & so & wide? \
hline
end{tabular*}
end{center}
It works with floating objects, too: see, for example, figure~ref{fig:a} and
table~ref{tab:b}.
begin{figure}[tbp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
includegraphics[width=1.2textwidth,height=5cm]{image}
caption{A example image}
label{fig:a}
end{figure}
begin{table}[bp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
And & what & about \
this & one, & eh? \
hline
end{tabular*}
caption{An example table}
label{tab:b}
end{table}
lipsum[2]
end{document}
This is the output:
addtolength{leftskip}{-2cm}
andaddtolength{rightskip}{-2cm}
seems a cleaner solution to me.
– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solutionaddtolength...
seems cleaner than the others", although it is much less voted.
– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
add a comment |
I’ve seen that an answer based on the use of centerline
has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:
% My standard header for TeX.SX answers:
documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
usepackage{mwe} % facilitates the writing of Minimale Working Examples like
% this one, not to be used in actual documents
begin{document}
lipsum[1]
begin{center}
addtolength{leftskip} {-2cm} % increase (absolute) value if needed
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
Does & this & table \
really & need & to \
be & so & wide? \
hline
end{tabular*}
end{center}
It works with floating objects, too: see, for example, figure~ref{fig:a} and
table~ref{tab:b}.
begin{figure}[tbp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
includegraphics[width=1.2textwidth,height=5cm]{image}
caption{A example image}
label{fig:a}
end{figure}
begin{table}[bp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
And & what & about \
this & one, & eh? \
hline
end{tabular*}
caption{An example table}
label{tab:b}
end{table}
lipsum[2]
end{document}
This is the output:
addtolength{leftskip}{-2cm}
andaddtolength{rightskip}{-2cm}
seems a cleaner solution to me.
– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solutionaddtolength...
seems cleaner than the others", although it is much less voted.
– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
add a comment |
I’ve seen that an answer based on the use of centerline
has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:
% My standard header for TeX.SX answers:
documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
usepackage{mwe} % facilitates the writing of Minimale Working Examples like
% this one, not to be used in actual documents
begin{document}
lipsum[1]
begin{center}
addtolength{leftskip} {-2cm} % increase (absolute) value if needed
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
Does & this & table \
really & need & to \
be & so & wide? \
hline
end{tabular*}
end{center}
It works with floating objects, too: see, for example, figure~ref{fig:a} and
table~ref{tab:b}.
begin{figure}[tbp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
includegraphics[width=1.2textwidth,height=5cm]{image}
caption{A example image}
label{fig:a}
end{figure}
begin{table}[bp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
And & what & about \
this & one, & eh? \
hline
end{tabular*}
caption{An example table}
label{tab:b}
end{table}
lipsum[2]
end{document}
This is the output:
I’ve seen that an answer based on the use of centerline
has been considered; I then thought that even the following crude hack, that I sometimes employ as a quick one-shot cure for similar situations, could be worth mentioning:
% My standard header for TeX.SX answers:
documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
usepackage{mwe} % facilitates the writing of Minimale Working Examples like
% this one, not to be used in actual documents
begin{document}
lipsum[1]
begin{center}
addtolength{leftskip} {-2cm} % increase (absolute) value if needed
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
Does & this & table \
really & need & to \
be & so & wide? \
hline
end{tabular*}
end{center}
It works with floating objects, too: see, for example, figure~ref{fig:a} and
table~ref{tab:b}.
begin{figure}[tbp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
includegraphics[width=1.2textwidth,height=5cm]{image}
caption{A example image}
label{fig:a}
end{figure}
begin{table}[bp]
centering
addtolength{leftskip} {-2cm}
addtolength{rightskip}{-2cm}
begin{tabular*}{1.2textwidth}{@{extracolsep{fill}}|ccc|}
hline
And & what & about \
this & one, & eh? \
hline
end{tabular*}
caption{An example table}
label{tab:b}
end{table}
lipsum[2]
end{document}
This is the output:
answered May 9 '18 at 23:34
GuMGuM
16.3k2455
16.3k2455
addtolength{leftskip}{-2cm}
andaddtolength{rightskip}{-2cm}
seems a cleaner solution to me.
– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solutionaddtolength...
seems cleaner than the others", although it is much less voted.
– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
add a comment |
addtolength{leftskip}{-2cm}
andaddtolength{rightskip}{-2cm}
seems a cleaner solution to me.
– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solutionaddtolength...
seems cleaner than the others", although it is much less voted.
– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
addtolength{leftskip}{-2cm}
and addtolength{rightskip}{-2cm}
seems a cleaner solution to me.– mmj
Jun 15 '18 at 7:15
addtolength{leftskip}{-2cm}
and addtolength{rightskip}{-2cm}
seems a cleaner solution to me.– mmj
Jun 15 '18 at 7:15
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
@mmj: I’m afraid I don’t understand: didn’t I do exactly that?
– GuM
Jun 15 '18 at 8:22
Maybe I wasn't clear enough, I should have written explicitly "your solution
addtolength...
seems cleaner than the others", although it is much less voted.– mmj
Jun 16 '18 at 19:59
Maybe I wasn't clear enough, I should have written explicitly "your solution
addtolength...
seems cleaner than the others", although it is much less voted.– mmj
Jun 16 '18 at 19:59
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
@mmj: Oh, now I see what you meant! Indeed, it has been a little silly of me not to understand it in the first place! And—well—thanks for your appreciation…
– GuM
Jun 16 '18 at 23:15
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.
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%2f39435%2fhow-can-i-center-a-too-wide-table%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
4
Have a look at Center flow chart horizontally, the answer works also for too wide tables, perhaps also have a look at Centering wide tables or figures. Similar solution here: How to center the minipage.
– Stefan Kottwitz♦
Dec 27 '11 at 16:30
Please compose a compilable MWE that illustrates the problem including the
documentclass
and the appropriate packages so that those trying to help don't have to recreate it.– Peter Grill
Dec 27 '11 at 16:30
1
@PeterGrill: I don't think a MWE is really necessary here. It's kind of a common, easily understandable issue.
– Martin Scharrer♦
Dec 27 '11 at 16:45
@martin Sure, but knowing, say, the class, help know which tools are readily available.
– daleif
Dec 27 '11 at 17:34
1
Wouldn't it be best to find the reason why the table is too wide, and solve that?
– DevSolar
Mar 22 '12 at 12:02