Adjustwidth not working for shifting ltablex table to the left












2















I want to shift my table slightly to the left of the page (exceeding left text width 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?










share|improve this question





























    2















    I want to shift my table slightly to the left of the page (exceeding left text width 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?










    share|improve this question



























      2












      2








      2








      I want to shift my table slightly to the left of the page (exceeding left text width 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?










      share|improve this question
















      I want to shift my table slightly to the left of the page (exceeding left text width 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 ltablex adjustwidth






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 29 at 19:57









      Zarko

      129k868169




      129k868169










      asked Mar 29 at 2:28









      user21398user21398

      394




      394






















          1 Answer
          1






          active

          oldest

          votes


















          2














          you have many issues with your table:





          • ltablex doesn't work well with adjustwidth. is your table really multi page long?

          • use of ltablex preserve X column tape only if cells' contents are wider than standard width of X column, otherwise it shrink column width to width if you have l column tape. a cure is add keepXColumns to document preamble

          • regardless that you have contents only one column of table (and others empty), you need always to write all ampersands. adding missed ampersands fixed your mine problem (if you not use ltablex but simple tabularx).


          • adjustwidth is not intended to change text width of more pages. for this is more appropriate to use newgeometry from geometry package


          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:



          enter image description here



          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}


          enter image description here



          addendum:
          According to your comment below, (one of the possible) solutions is to add a one column to the table and to redesign the mcx command. i also suggest to ad more vertical space before row with mcx command (all changes are in code indicated by % <---):



          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}
          usepackage[strict]{changepage}
          usepackage[font=footnotesize,
          labelfont=bf,
          labelsep=space,
          skip=1ex]{caption}
          captionsetup[table]{singlelinecheck=false,
          justification=raggedright}

          begin{document}
          begingroup % <---
          footnotesizelinespread{0.84}selectfont % <---
          renewcommand{arraystretch}{1.2} % <---
          setlengthtabcolsep{4pt} % <---
          newcommandmcx[1]{multicolumn{2}%
          {@{}>{hsize=dimexpr1.75hsize+2tabcolsep}L}{#1}} % <---
          begin{tabularx}{linewidth}{@{}
          l % <---
          >{hsize=1.75hsize}L
          *{5}{>{hsize=0.95hsize}C}
          @{}}
          caption{caption}
          label{resultstable} \
          toprule
          & thead[bl]{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[bl]{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{some very long variable name without indented text}
          & & & & \
          addlinespace
          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) \
          addlinespace
          mcx{varz} & & & & & \
          & varu & & & & & \
          & varrn & & & & & \
          & No. of product switches in 2 yr, median (IRQ)
          & 0.93 (0.12)
          & 0.52 (0.28)
          & 0.53 (0.21)
          & 0.23 (0.22)
          & 0.02 (0.07) \
          & varx & 0.92 (0.13)
          & 0.65 (0.26)
          & 0.65 (0.19)
          & 0.49 (0.23)
          & 0.44 (0.23) \
          addlinespace
          mcx{var)} & & & & & \
          end{tabularx}
          endgroup % <---
          end{document}


          enter image description here



          (red lines indicate text borders)






          share|improve this answer


























          • Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

            – user21398
            Mar 29 at 17:36






          • 1





            see addendum in my answer.

            – Zarko
            Mar 29 at 20:00












          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482029%2fadjustwidth-not-working-for-shifting-ltablex-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









          2














          you have many issues with your table:





          • ltablex doesn't work well with adjustwidth. is your table really multi page long?

          • use of ltablex preserve X column tape only if cells' contents are wider than standard width of X column, otherwise it shrink column width to width if you have l column tape. a cure is add keepXColumns to document preamble

          • regardless that you have contents only one column of table (and others empty), you need always to write all ampersands. adding missed ampersands fixed your mine problem (if you not use ltablex but simple tabularx).


          • adjustwidth is not intended to change text width of more pages. for this is more appropriate to use newgeometry from geometry package


          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:



          enter image description here



          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}


          enter image description here



          addendum:
          According to your comment below, (one of the possible) solutions is to add a one column to the table and to redesign the mcx command. i also suggest to ad more vertical space before row with mcx command (all changes are in code indicated by % <---):



          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}
          usepackage[strict]{changepage}
          usepackage[font=footnotesize,
          labelfont=bf,
          labelsep=space,
          skip=1ex]{caption}
          captionsetup[table]{singlelinecheck=false,
          justification=raggedright}

          begin{document}
          begingroup % <---
          footnotesizelinespread{0.84}selectfont % <---
          renewcommand{arraystretch}{1.2} % <---
          setlengthtabcolsep{4pt} % <---
          newcommandmcx[1]{multicolumn{2}%
          {@{}>{hsize=dimexpr1.75hsize+2tabcolsep}L}{#1}} % <---
          begin{tabularx}{linewidth}{@{}
          l % <---
          >{hsize=1.75hsize}L
          *{5}{>{hsize=0.95hsize}C}
          @{}}
          caption{caption}
          label{resultstable} \
          toprule
          & thead[bl]{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[bl]{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{some very long variable name without indented text}
          & & & & \
          addlinespace
          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) \
          addlinespace
          mcx{varz} & & & & & \
          & varu & & & & & \
          & varrn & & & & & \
          & No. of product switches in 2 yr, median (IRQ)
          & 0.93 (0.12)
          & 0.52 (0.28)
          & 0.53 (0.21)
          & 0.23 (0.22)
          & 0.02 (0.07) \
          & varx & 0.92 (0.13)
          & 0.65 (0.26)
          & 0.65 (0.19)
          & 0.49 (0.23)
          & 0.44 (0.23) \
          addlinespace
          mcx{var)} & & & & & \
          end{tabularx}
          endgroup % <---
          end{document}


          enter image description here



          (red lines indicate text borders)






          share|improve this answer


























          • Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

            – user21398
            Mar 29 at 17:36






          • 1





            see addendum in my answer.

            – Zarko
            Mar 29 at 20:00
















          2














          you have many issues with your table:





          • ltablex doesn't work well with adjustwidth. is your table really multi page long?

          • use of ltablex preserve X column tape only if cells' contents are wider than standard width of X column, otherwise it shrink column width to width if you have l column tape. a cure is add keepXColumns to document preamble

          • regardless that you have contents only one column of table (and others empty), you need always to write all ampersands. adding missed ampersands fixed your mine problem (if you not use ltablex but simple tabularx).


          • adjustwidth is not intended to change text width of more pages. for this is more appropriate to use newgeometry from geometry package


          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:



          enter image description here



          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}


          enter image description here



          addendum:
          According to your comment below, (one of the possible) solutions is to add a one column to the table and to redesign the mcx command. i also suggest to ad more vertical space before row with mcx command (all changes are in code indicated by % <---):



          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}
          usepackage[strict]{changepage}
          usepackage[font=footnotesize,
          labelfont=bf,
          labelsep=space,
          skip=1ex]{caption}
          captionsetup[table]{singlelinecheck=false,
          justification=raggedright}

          begin{document}
          begingroup % <---
          footnotesizelinespread{0.84}selectfont % <---
          renewcommand{arraystretch}{1.2} % <---
          setlengthtabcolsep{4pt} % <---
          newcommandmcx[1]{multicolumn{2}%
          {@{}>{hsize=dimexpr1.75hsize+2tabcolsep}L}{#1}} % <---
          begin{tabularx}{linewidth}{@{}
          l % <---
          >{hsize=1.75hsize}L
          *{5}{>{hsize=0.95hsize}C}
          @{}}
          caption{caption}
          label{resultstable} \
          toprule
          & thead[bl]{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[bl]{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{some very long variable name without indented text}
          & & & & \
          addlinespace
          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) \
          addlinespace
          mcx{varz} & & & & & \
          & varu & & & & & \
          & varrn & & & & & \
          & No. of product switches in 2 yr, median (IRQ)
          & 0.93 (0.12)
          & 0.52 (0.28)
          & 0.53 (0.21)
          & 0.23 (0.22)
          & 0.02 (0.07) \
          & varx & 0.92 (0.13)
          & 0.65 (0.26)
          & 0.65 (0.19)
          & 0.49 (0.23)
          & 0.44 (0.23) \
          addlinespace
          mcx{var)} & & & & & \
          end{tabularx}
          endgroup % <---
          end{document}


          enter image description here



          (red lines indicate text borders)






          share|improve this answer


























          • Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

            – user21398
            Mar 29 at 17:36






          • 1





            see addendum in my answer.

            – Zarko
            Mar 29 at 20:00














          2












          2








          2







          you have many issues with your table:





          • ltablex doesn't work well with adjustwidth. is your table really multi page long?

          • use of ltablex preserve X column tape only if cells' contents are wider than standard width of X column, otherwise it shrink column width to width if you have l column tape. a cure is add keepXColumns to document preamble

          • regardless that you have contents only one column of table (and others empty), you need always to write all ampersands. adding missed ampersands fixed your mine problem (if you not use ltablex but simple tabularx).


          • adjustwidth is not intended to change text width of more pages. for this is more appropriate to use newgeometry from geometry package


          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:



          enter image description here



          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}


          enter image description here



          addendum:
          According to your comment below, (one of the possible) solutions is to add a one column to the table and to redesign the mcx command. i also suggest to ad more vertical space before row with mcx command (all changes are in code indicated by % <---):



          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}
          usepackage[strict]{changepage}
          usepackage[font=footnotesize,
          labelfont=bf,
          labelsep=space,
          skip=1ex]{caption}
          captionsetup[table]{singlelinecheck=false,
          justification=raggedright}

          begin{document}
          begingroup % <---
          footnotesizelinespread{0.84}selectfont % <---
          renewcommand{arraystretch}{1.2} % <---
          setlengthtabcolsep{4pt} % <---
          newcommandmcx[1]{multicolumn{2}%
          {@{}>{hsize=dimexpr1.75hsize+2tabcolsep}L}{#1}} % <---
          begin{tabularx}{linewidth}{@{}
          l % <---
          >{hsize=1.75hsize}L
          *{5}{>{hsize=0.95hsize}C}
          @{}}
          caption{caption}
          label{resultstable} \
          toprule
          & thead[bl]{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[bl]{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{some very long variable name without indented text}
          & & & & \
          addlinespace
          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) \
          addlinespace
          mcx{varz} & & & & & \
          & varu & & & & & \
          & varrn & & & & & \
          & No. of product switches in 2 yr, median (IRQ)
          & 0.93 (0.12)
          & 0.52 (0.28)
          & 0.53 (0.21)
          & 0.23 (0.22)
          & 0.02 (0.07) \
          & varx & 0.92 (0.13)
          & 0.65 (0.26)
          & 0.65 (0.19)
          & 0.49 (0.23)
          & 0.44 (0.23) \
          addlinespace
          mcx{var)} & & & & & \
          end{tabularx}
          endgroup % <---
          end{document}


          enter image description here



          (red lines indicate text borders)






          share|improve this answer















          you have many issues with your table:





          • ltablex doesn't work well with adjustwidth. is your table really multi page long?

          • use of ltablex preserve X column tape only if cells' contents are wider than standard width of X column, otherwise it shrink column width to width if you have l column tape. a cure is add keepXColumns to document preamble

          • regardless that you have contents only one column of table (and others empty), you need always to write all ampersands. adding missed ampersands fixed your mine problem (if you not use ltablex but simple tabularx).


          • adjustwidth is not intended to change text width of more pages. for this is more appropriate to use newgeometry from geometry package


          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:



          enter image description here



          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}


          enter image description here



          addendum:
          According to your comment below, (one of the possible) solutions is to add a one column to the table and to redesign the mcx command. i also suggest to ad more vertical space before row with mcx command (all changes are in code indicated by % <---):



          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}
          usepackage[strict]{changepage}
          usepackage[font=footnotesize,
          labelfont=bf,
          labelsep=space,
          skip=1ex]{caption}
          captionsetup[table]{singlelinecheck=false,
          justification=raggedright}

          begin{document}
          begingroup % <---
          footnotesizelinespread{0.84}selectfont % <---
          renewcommand{arraystretch}{1.2} % <---
          setlengthtabcolsep{4pt} % <---
          newcommandmcx[1]{multicolumn{2}%
          {@{}>{hsize=dimexpr1.75hsize+2tabcolsep}L}{#1}} % <---
          begin{tabularx}{linewidth}{@{}
          l % <---
          >{hsize=1.75hsize}L
          *{5}{>{hsize=0.95hsize}C}
          @{}}
          caption{caption}
          label{resultstable} \
          toprule
          & thead[bl]{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[bl]{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{some very long variable name without indented text}
          & & & & \
          addlinespace
          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) \
          addlinespace
          mcx{varz} & & & & & \
          & varu & & & & & \
          & varrn & & & & & \
          & No. of product switches in 2 yr, median (IRQ)
          & 0.93 (0.12)
          & 0.52 (0.28)
          & 0.53 (0.21)
          & 0.23 (0.22)
          & 0.02 (0.07) \
          & varx & 0.92 (0.13)
          & 0.65 (0.26)
          & 0.65 (0.19)
          & 0.49 (0.23)
          & 0.44 (0.23) \
          addlinespace
          mcx{var)} & & & & & \
          end{tabularx}
          endgroup % <---
          end{document}


          enter image description here



          (red lines indicate text borders)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 29 at 19:44

























          answered Mar 29 at 3:23









          ZarkoZarko

          129k868169




          129k868169













          • Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

            – user21398
            Mar 29 at 17:36






          • 1





            see addendum in my answer.

            – Zarko
            Mar 29 at 20:00



















          • Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

            – user21398
            Mar 29 at 17:36






          • 1





            see addendum in my answer.

            – Zarko
            Mar 29 at 20:00

















          Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

          – user21398
          Mar 29 at 17:36





          Cheers. I have one question regarding second option. How can you make it so that the text below mcx lines up if it is too long? For example in this picture i.imgur.com/dnvttNx.png How can you make it so "median" is shift to the right?

          – user21398
          Mar 29 at 17:36




          1




          1





          see addendum in my answer.

          – Zarko
          Mar 29 at 20:00





          see addendum in my answer.

          – Zarko
          Mar 29 at 20:00


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482029%2fadjustwidth-not-working-for-shifting-ltablex-table-to-the-left%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents