Adjustwidth not working for shifting tabularx table to the left
I want to shift my table slightly to the left of the page (exceeding left textwidth boundary). After many googles I however keep having trouble and can't manage to get adjustwidth to work:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{tcolorbox}
usepackage{color}
usepackage{listings}
usepackage{titlesec}
usepackage{ragged2e}
usepackage{fancyhdr}
usepackage{graphicx}
usepackage{booktabs, ltablex, makecell}
usepackage{siunitx}[input-decimal-markers=.]
usepackage{lipsum}
usepackage{threeparttable}
usepackage{pdflscape}
usepackage[strict]{changepage}
usepackage{enumitem}
usepackage{makecell}
usepackage{array}
usepackage[sort, numbers, compress]{natbib}
usepackage{amsmath}
usepackage{mathabx}
usepackage{makebox}
usepackage[font=footnotesize,labelfont=bf,labelsep=space ]{caption}
usepackage[title]{appendix}
usepackage[export]{adjustbox}
usepackage[hidelinks]{hyperref}
renewcommandleqvarleq
renewcommandgeqvargeq
interfootnotelinepenalty=10000
addtolength{skipfootins}{10pt}
captionsetup[table]{singlelinecheck=false,justification=raggedright}
%
%newcolumntype{L}{>{raggedrightarraybackslash}X}
%newcolumntype{b}{>{hsize=0.75hsize}X}
%newcolumntype{B}{>{hsize=1.25hsize raggedrightarraybackslash}X}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
usepackage{showframe}
begin{document}
begin{adjustwidth}{-1in}{-1cm}
footnotesize
% renewcommand{theadalign}{lbc}
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{lXXXXX}
caption{caption}label{resultstable}\
toprule
thead[l]{footnotesize vspace{-6mm} variables} & thead{footnotesize \ 1 \ } & thead{footnotesize Cluster \ 2 \(n=111)} & thead{footnotesize \ 3 \(n=111)} &
thead{footnotesize \4\()} & thead{footnotesize \5\()} \
midrule
endfirsthead
caption{Continued.}\
toprule
thead[l]{footnotesize vspace{-6mm} 1} & thead{footnotesize 1 \ } & thead{footnotesize 2} & thead{footnotesize 3} &
thead{footnotesize 4} & thead{footnotesize 5} \
midrule
endhead
textit{Very very very very Long variable name}&\
hspace{1mm}var2\
qquad varx& 0.92 (0.13)& 0.65 (0.26) & 0.65 (0.19)& 0.49 (0.23)&
0.44 (0.23)\
qquad vary& 0.93 (0.12)& 0.52 (0.28) & 0.53 (0.21) & 0.23 (0.22)&0.02 (0.07)\
qquad varz&\
qquad varu&\
qquad varrn&\
hspace{1mm}varrqe&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
hspace{1mm}var)&\
bottomrule
end{tabularx}
end{adjustwidth}
end{document}
It perfectly extends the table to the right, but will not do so for the left side. It does however extend the caption to the left, but not the whole table? Does anybody know why this is? Is it perhaps because of the multitude of used packages?
tables tabularx adjustwidth
add a comment |
I want to shift my table slightly to the left of the page (exceeding left textwidth boundary). After many googles I however keep having trouble and can't manage to get adjustwidth to work:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{tcolorbox}
usepackage{color}
usepackage{listings}
usepackage{titlesec}
usepackage{ragged2e}
usepackage{fancyhdr}
usepackage{graphicx}
usepackage{booktabs, ltablex, makecell}
usepackage{siunitx}[input-decimal-markers=.]
usepackage{lipsum}
usepackage{threeparttable}
usepackage{pdflscape}
usepackage[strict]{changepage}
usepackage{enumitem}
usepackage{makecell}
usepackage{array}
usepackage[sort, numbers, compress]{natbib}
usepackage{amsmath}
usepackage{mathabx}
usepackage{makebox}
usepackage[font=footnotesize,labelfont=bf,labelsep=space ]{caption}
usepackage[title]{appendix}
usepackage[export]{adjustbox}
usepackage[hidelinks]{hyperref}
renewcommandleqvarleq
renewcommandgeqvargeq
interfootnotelinepenalty=10000
addtolength{skipfootins}{10pt}
captionsetup[table]{singlelinecheck=false,justification=raggedright}
%
%newcolumntype{L}{>{raggedrightarraybackslash}X}
%newcolumntype{b}{>{hsize=0.75hsize}X}
%newcolumntype{B}{>{hsize=1.25hsize raggedrightarraybackslash}X}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
usepackage{showframe}
begin{document}
begin{adjustwidth}{-1in}{-1cm}
footnotesize
% renewcommand{theadalign}{lbc}
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{lXXXXX}
caption{caption}label{resultstable}\
toprule
thead[l]{footnotesize vspace{-6mm} variables} & thead{footnotesize \ 1 \ } & thead{footnotesize Cluster \ 2 \(n=111)} & thead{footnotesize \ 3 \(n=111)} &
thead{footnotesize \4\()} & thead{footnotesize \5\()} \
midrule
endfirsthead
caption{Continued.}\
toprule
thead[l]{footnotesize vspace{-6mm} 1} & thead{footnotesize 1 \ } & thead{footnotesize 2} & thead{footnotesize 3} &
thead{footnotesize 4} & thead{footnotesize 5} \
midrule
endhead
textit{Very very very very Long variable name}&\
hspace{1mm}var2\
qquad varx& 0.92 (0.13)& 0.65 (0.26) & 0.65 (0.19)& 0.49 (0.23)&
0.44 (0.23)\
qquad vary& 0.93 (0.12)& 0.52 (0.28) & 0.53 (0.21) & 0.23 (0.22)&0.02 (0.07)\
qquad varz&\
qquad varu&\
qquad varrn&\
hspace{1mm}varrqe&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
hspace{1mm}var)&\
bottomrule
end{tabularx}
end{adjustwidth}
end{document}
It perfectly extends the table to the right, but will not do so for the left side. It does however extend the caption to the left, but not the whole table? Does anybody know why this is? Is it perhaps because of the multitude of used packages?
tables tabularx adjustwidth
add a comment |
I want to shift my table slightly to the left of the page (exceeding left textwidth boundary). After many googles I however keep having trouble and can't manage to get adjustwidth to work:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{tcolorbox}
usepackage{color}
usepackage{listings}
usepackage{titlesec}
usepackage{ragged2e}
usepackage{fancyhdr}
usepackage{graphicx}
usepackage{booktabs, ltablex, makecell}
usepackage{siunitx}[input-decimal-markers=.]
usepackage{lipsum}
usepackage{threeparttable}
usepackage{pdflscape}
usepackage[strict]{changepage}
usepackage{enumitem}
usepackage{makecell}
usepackage{array}
usepackage[sort, numbers, compress]{natbib}
usepackage{amsmath}
usepackage{mathabx}
usepackage{makebox}
usepackage[font=footnotesize,labelfont=bf,labelsep=space ]{caption}
usepackage[title]{appendix}
usepackage[export]{adjustbox}
usepackage[hidelinks]{hyperref}
renewcommandleqvarleq
renewcommandgeqvargeq
interfootnotelinepenalty=10000
addtolength{skipfootins}{10pt}
captionsetup[table]{singlelinecheck=false,justification=raggedright}
%
%newcolumntype{L}{>{raggedrightarraybackslash}X}
%newcolumntype{b}{>{hsize=0.75hsize}X}
%newcolumntype{B}{>{hsize=1.25hsize raggedrightarraybackslash}X}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
usepackage{showframe}
begin{document}
begin{adjustwidth}{-1in}{-1cm}
footnotesize
% renewcommand{theadalign}{lbc}
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{lXXXXX}
caption{caption}label{resultstable}\
toprule
thead[l]{footnotesize vspace{-6mm} variables} & thead{footnotesize \ 1 \ } & thead{footnotesize Cluster \ 2 \(n=111)} & thead{footnotesize \ 3 \(n=111)} &
thead{footnotesize \4\()} & thead{footnotesize \5\()} \
midrule
endfirsthead
caption{Continued.}\
toprule
thead[l]{footnotesize vspace{-6mm} 1} & thead{footnotesize 1 \ } & thead{footnotesize 2} & thead{footnotesize 3} &
thead{footnotesize 4} & thead{footnotesize 5} \
midrule
endhead
textit{Very very very very Long variable name}&\
hspace{1mm}var2\
qquad varx& 0.92 (0.13)& 0.65 (0.26) & 0.65 (0.19)& 0.49 (0.23)&
0.44 (0.23)\
qquad vary& 0.93 (0.12)& 0.52 (0.28) & 0.53 (0.21) & 0.23 (0.22)&0.02 (0.07)\
qquad varz&\
qquad varu&\
qquad varrn&\
hspace{1mm}varrqe&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
hspace{1mm}var)&\
bottomrule
end{tabularx}
end{adjustwidth}
end{document}
It perfectly extends the table to the right, but will not do so for the left side. It does however extend the caption to the left, but not the whole table? Does anybody know why this is? Is it perhaps because of the multitude of used packages?
tables tabularx adjustwidth
I want to shift my table slightly to the left of the page (exceeding left textwidth boundary). After many googles I however keep having trouble and can't manage to get adjustwidth to work:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{tcolorbox}
usepackage{color}
usepackage{listings}
usepackage{titlesec}
usepackage{ragged2e}
usepackage{fancyhdr}
usepackage{graphicx}
usepackage{booktabs, ltablex, makecell}
usepackage{siunitx}[input-decimal-markers=.]
usepackage{lipsum}
usepackage{threeparttable}
usepackage{pdflscape}
usepackage[strict]{changepage}
usepackage{enumitem}
usepackage{makecell}
usepackage{array}
usepackage[sort, numbers, compress]{natbib}
usepackage{amsmath}
usepackage{mathabx}
usepackage{makebox}
usepackage[font=footnotesize,labelfont=bf,labelsep=space ]{caption}
usepackage[title]{appendix}
usepackage[export]{adjustbox}
usepackage[hidelinks]{hyperref}
renewcommandleqvarleq
renewcommandgeqvargeq
interfootnotelinepenalty=10000
addtolength{skipfootins}{10pt}
captionsetup[table]{singlelinecheck=false,justification=raggedright}
%
%newcolumntype{L}{>{raggedrightarraybackslash}X}
%newcolumntype{b}{>{hsize=0.75hsize}X}
%newcolumntype{B}{>{hsize=1.25hsize raggedrightarraybackslash}X}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
usepackage{showframe}
begin{document}
begin{adjustwidth}{-1in}{-1cm}
footnotesize
% renewcommand{theadalign}{lbc}
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{lXXXXX}
caption{caption}label{resultstable}\
toprule
thead[l]{footnotesize vspace{-6mm} variables} & thead{footnotesize \ 1 \ } & thead{footnotesize Cluster \ 2 \(n=111)} & thead{footnotesize \ 3 \(n=111)} &
thead{footnotesize \4\()} & thead{footnotesize \5\()} \
midrule
endfirsthead
caption{Continued.}\
toprule
thead[l]{footnotesize vspace{-6mm} 1} & thead{footnotesize 1 \ } & thead{footnotesize 2} & thead{footnotesize 3} &
thead{footnotesize 4} & thead{footnotesize 5} \
midrule
endhead
textit{Very very very very Long variable name}&\
hspace{1mm}var2\
qquad varx& 0.92 (0.13)& 0.65 (0.26) & 0.65 (0.19)& 0.49 (0.23)&
0.44 (0.23)\
qquad vary& 0.93 (0.12)& 0.52 (0.28) & 0.53 (0.21) & 0.23 (0.22)&0.02 (0.07)\
qquad varz&\
qquad varu&\
qquad varrn&\
hspace{1mm}varrqe&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
qquad var&\
hspace{1mm}var)&\
bottomrule
end{tabularx}
end{adjustwidth}
end{document}
It perfectly extends the table to the right, but will not do so for the left side. It does however extend the caption to the left, but not the whole table? Does anybody know why this is? Is it perhaps because of the multitude of used packages?
tables tabularx adjustwidth
tables tabularx adjustwidth
asked 2 hours ago
user21398user21398
274
274
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
you have many issues with your table:
ltablex
doesn't work well withadjustwidth
. is your table really multi page long?- use of
ltablex
preserveX
column tape only if cells' contents are wider than standard width ofX
column, otherwise it shrink column width to width if you havel
column tape. a cure is addkeepXColumns
to document preamble - regardless that you have contents only one column of table (and others empty), you need to always write all ampersands. adding missed ampersands fixed your mine problem.
adjustwidth
is not intended to change text width of more pages. for this is more appropriate to usenewgeometry
consider above comments, the table can be written as:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
makecell,
tabularx,
threeparttable}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcommandmcl[1]{multicolumn{1}{l}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
begin{table}[htb]
begin{adjustwidth}{-1cm}{-1cm}
footnotesize
renewcommand{arraystretch}{1.4}
caption{caption}
label{resultstable}
begin{tabularx}{linewidth}{>{quad}l X X X X X }
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
mcl{textit{Very very very very Long variable name}}
& & & & \
mcl{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcl{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcl{var)} & & & & & \
bottomrule
end{tabularx}
end{adjustwidth}
end{table}
end{document}
which gives:
if you make Very very very very Long variable name
shorter, for example with use of abrevation or with break it into two or more lines, than the use of adjustwidth
wouldn't be necessary anymore. in this case use of `ltablex for this table will works as expected:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
longtable,
ltablex,
makecell,
threeparttable}
keepXColumns
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcolumntype{C}{>{centeringarraybackslash}X}
newcolumntype{L}{>{raggedrightarraybackslash}X}
newcommandmcx[1]{multicolumn{1}{@{}>{hsize=1.75hsize}X}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
footnotesize
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{@{}>{quadhsize=1.75hsize}L
*{5}{>{hsize=0.95hsize}C}
@{}}
caption{caption}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endfirsthead
caption{caption (cont.)}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endhead
midrule
multicolumn{6}{r}{textit{continue on the next page}}
endfoot
bottomrule
endlastfoot
mcx{itshape
Very very very very Long variable name}
& & & & \
mcx{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcx{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcx{var)} & & & & & \
end{tabularx}
end{document}
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%2f482029%2fadjustwidth-not-working-for-shifting-tabularx-table-to-the-left%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
you have many issues with your table:
ltablex
doesn't work well withadjustwidth
. is your table really multi page long?- use of
ltablex
preserveX
column tape only if cells' contents are wider than standard width ofX
column, otherwise it shrink column width to width if you havel
column tape. a cure is addkeepXColumns
to document preamble - regardless that you have contents only one column of table (and others empty), you need to always write all ampersands. adding missed ampersands fixed your mine problem.
adjustwidth
is not intended to change text width of more pages. for this is more appropriate to usenewgeometry
consider above comments, the table can be written as:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
makecell,
tabularx,
threeparttable}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcommandmcl[1]{multicolumn{1}{l}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
begin{table}[htb]
begin{adjustwidth}{-1cm}{-1cm}
footnotesize
renewcommand{arraystretch}{1.4}
caption{caption}
label{resultstable}
begin{tabularx}{linewidth}{>{quad}l X X X X X }
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
mcl{textit{Very very very very Long variable name}}
& & & & \
mcl{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcl{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcl{var)} & & & & & \
bottomrule
end{tabularx}
end{adjustwidth}
end{table}
end{document}
which gives:
if you make Very very very very Long variable name
shorter, for example with use of abrevation or with break it into two or more lines, than the use of adjustwidth
wouldn't be necessary anymore. in this case use of `ltablex for this table will works as expected:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
longtable,
ltablex,
makecell,
threeparttable}
keepXColumns
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcolumntype{C}{>{centeringarraybackslash}X}
newcolumntype{L}{>{raggedrightarraybackslash}X}
newcommandmcx[1]{multicolumn{1}{@{}>{hsize=1.75hsize}X}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
footnotesize
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{@{}>{quadhsize=1.75hsize}L
*{5}{>{hsize=0.95hsize}C}
@{}}
caption{caption}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endfirsthead
caption{caption (cont.)}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endhead
midrule
multicolumn{6}{r}{textit{continue on the next page}}
endfoot
bottomrule
endlastfoot
mcx{itshape
Very very very very Long variable name}
& & & & \
mcx{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcx{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcx{var)} & & & & & \
end{tabularx}
end{document}
add a comment |
you have many issues with your table:
ltablex
doesn't work well withadjustwidth
. is your table really multi page long?- use of
ltablex
preserveX
column tape only if cells' contents are wider than standard width ofX
column, otherwise it shrink column width to width if you havel
column tape. a cure is addkeepXColumns
to document preamble - regardless that you have contents only one column of table (and others empty), you need to always write all ampersands. adding missed ampersands fixed your mine problem.
adjustwidth
is not intended to change text width of more pages. for this is more appropriate to usenewgeometry
consider above comments, the table can be written as:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
makecell,
tabularx,
threeparttable}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcommandmcl[1]{multicolumn{1}{l}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
begin{table}[htb]
begin{adjustwidth}{-1cm}{-1cm}
footnotesize
renewcommand{arraystretch}{1.4}
caption{caption}
label{resultstable}
begin{tabularx}{linewidth}{>{quad}l X X X X X }
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
mcl{textit{Very very very very Long variable name}}
& & & & \
mcl{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcl{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcl{var)} & & & & & \
bottomrule
end{tabularx}
end{adjustwidth}
end{table}
end{document}
which gives:
if you make Very very very very Long variable name
shorter, for example with use of abrevation or with break it into two or more lines, than the use of adjustwidth
wouldn't be necessary anymore. in this case use of `ltablex for this table will works as expected:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
longtable,
ltablex,
makecell,
threeparttable}
keepXColumns
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcolumntype{C}{>{centeringarraybackslash}X}
newcolumntype{L}{>{raggedrightarraybackslash}X}
newcommandmcx[1]{multicolumn{1}{@{}>{hsize=1.75hsize}X}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
footnotesize
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{@{}>{quadhsize=1.75hsize}L
*{5}{>{hsize=0.95hsize}C}
@{}}
caption{caption}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endfirsthead
caption{caption (cont.)}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endhead
midrule
multicolumn{6}{r}{textit{continue on the next page}}
endfoot
bottomrule
endlastfoot
mcx{itshape
Very very very very Long variable name}
& & & & \
mcx{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcx{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcx{var)} & & & & & \
end{tabularx}
end{document}
add a comment |
you have many issues with your table:
ltablex
doesn't work well withadjustwidth
. is your table really multi page long?- use of
ltablex
preserveX
column tape only if cells' contents are wider than standard width ofX
column, otherwise it shrink column width to width if you havel
column tape. a cure is addkeepXColumns
to document preamble - regardless that you have contents only one column of table (and others empty), you need to always write all ampersands. adding missed ampersands fixed your mine problem.
adjustwidth
is not intended to change text width of more pages. for this is more appropriate to usenewgeometry
consider above comments, the table can be written as:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
makecell,
tabularx,
threeparttable}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcommandmcl[1]{multicolumn{1}{l}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
begin{table}[htb]
begin{adjustwidth}{-1cm}{-1cm}
footnotesize
renewcommand{arraystretch}{1.4}
caption{caption}
label{resultstable}
begin{tabularx}{linewidth}{>{quad}l X X X X X }
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
mcl{textit{Very very very very Long variable name}}
& & & & \
mcl{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcl{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcl{var)} & & & & & \
bottomrule
end{tabularx}
end{adjustwidth}
end{table}
end{document}
which gives:
if you make Very very very very Long variable name
shorter, for example with use of abrevation or with break it into two or more lines, than the use of adjustwidth
wouldn't be necessary anymore. in this case use of `ltablex for this table will works as expected:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
longtable,
ltablex,
makecell,
threeparttable}
keepXColumns
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcolumntype{C}{>{centeringarraybackslash}X}
newcolumntype{L}{>{raggedrightarraybackslash}X}
newcommandmcx[1]{multicolumn{1}{@{}>{hsize=1.75hsize}X}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
footnotesize
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{@{}>{quadhsize=1.75hsize}L
*{5}{>{hsize=0.95hsize}C}
@{}}
caption{caption}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endfirsthead
caption{caption (cont.)}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endhead
midrule
multicolumn{6}{r}{textit{continue on the next page}}
endfoot
bottomrule
endlastfoot
mcx{itshape
Very very very very Long variable name}
& & & & \
mcx{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcx{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcx{var)} & & & & & \
end{tabularx}
end{document}
you have many issues with your table:
ltablex
doesn't work well withadjustwidth
. is your table really multi page long?- use of
ltablex
preserveX
column tape only if cells' contents are wider than standard width ofX
column, otherwise it shrink column width to width if you havel
column tape. a cure is addkeepXColumns
to document preamble - regardless that you have contents only one column of table (and others empty), you need to always write all ampersands. adding missed ampersands fixed your mine problem.
adjustwidth
is not intended to change text width of more pages. for this is more appropriate to usenewgeometry
consider above comments, the table can be written as:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
makecell,
tabularx,
threeparttable}
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcommandmcl[1]{multicolumn{1}{l}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
begin{table}[htb]
begin{adjustwidth}{-1cm}{-1cm}
footnotesize
renewcommand{arraystretch}{1.4}
caption{caption}
label{resultstable}
begin{tabularx}{linewidth}{>{quad}l X X X X X }
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
mcl{textit{Very very very very Long variable name}}
& & & & \
mcl{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcl{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcl{var)} & & & & & \
bottomrule
end{tabularx}
end{adjustwidth}
end{table}
end{document}
which gives:
if you make Very very very very Long variable name
shorter, for example with use of abrevation or with break it into two or more lines, than the use of adjustwidth
wouldn't be necessary anymore. in this case use of `ltablex for this table will works as expected:
documentclass[a4paper, 12pt]{article}
usepackage[margin=1.1in]{geometry}
usepackage{booktabs,
longtable,
ltablex,
makecell,
threeparttable}
keepXColumns
renewcommandtheadfont{footnotesizebfseries}
renewcommandtheadgape{}
newcolumntype{C}{>{centeringarraybackslash}X}
newcolumntype{L}{>{raggedrightarraybackslash}X}
newcommandmcx[1]{multicolumn{1}{@{}>{hsize=1.75hsize}X}{#1}}
usepackage[strict]{changepage}
usepackage[font=footnotesize,
labelfont=bf,
labelsep=space]{caption}
captionsetup[table]{singlelinecheck=false,
justification=raggedright}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%
begin{document}
footnotesize
renewcommand{arraystretch}{1.4}
begin{tabularx}{linewidth}{@{}>{quadhsize=1.75hsize}L
*{5}{>{hsize=0.95hsize}C}
@{}}
caption{caption}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endfirsthead
caption{caption (cont.)}
label{resultstable} \
toprule
thead[b]{variables}
& thead[b]{1}
& thead[b]{Cluster \ 2 \(n=111)}
& thead[b]{3 \(n=111)}
& thead[b]{4\()}
& thead[b]{5\()} \
midrule
endhead
midrule
multicolumn{6}{r}{textit{continue on the next page}}
endfoot
bottomrule
endlastfoot
mcx{itshape
Very very very very Long variable name}
& & & & \
mcx{var2} & & & & & \
varx & 0.92 (0.13)
& 0.65 (0.26)
& 0.65 (0.19)
& 0.49 (0.23)
& 0.44 (0.23) \
vary & 0.93 (0.12)
& 0.52 (0.28)
& 0.53 (0.21)
& 0.23 (0.22)
& 0.02 (0.07) \
mcx{varz} & & & & & \
varu & & & & & \
varrn & & & & & \
varrqe & & & & & \
mcx{var)} & & & & & \
end{tabularx}
end{document}
edited 1 hour ago
answered 1 hour ago
ZarkoZarko
128k868167
128k868167
add a comment |
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%2f482029%2fadjustwidth-not-working-for-shifting-tabularx-table-to-the-left%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