How to change margins for a table defined in tabularx environment?











up vote
1
down vote

favorite












I would like to move my table



documentclass[a4paper, 12pt]{article}
usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
usepackage{ltablex}

begin{document}
begin{tabularx}{linewidth}{llllllllllllllllllllllll}
caption{Numbers}\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
end{tabularx}

end{document}


to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?










share|improve this question




























    up vote
    1
    down vote

    favorite












    I would like to move my table



    documentclass[a4paper, 12pt]{article}
    usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
    usepackage{ltablex}

    begin{document}
    begin{tabularx}{linewidth}{llllllllllllllllllllllll}
    caption{Numbers}\hline
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
    1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
    end{tabularx}

    end{document}


    to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I would like to move my table



      documentclass[a4paper, 12pt]{article}
      usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
      usepackage{ltablex}

      begin{document}
      begin{tabularx}{linewidth}{llllllllllllllllllllllll}
      caption{Numbers}\hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      end{tabularx}

      end{document}


      to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?










      share|improve this question















      I would like to move my table



      documentclass[a4paper, 12pt]{article}
      usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
      usepackage{ltablex}

      begin{document}
      begin{tabularx}{linewidth}{llllllllllllllllllllllll}
      caption{Numbers}\hline
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
      end{tabularx}

      end{document}


      to the left and to the top. Could you please help me how to change margins for my table defined in tabularx environment?







      margins tabularx leftmargin






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday

























      asked yesterday









      Roloka

      285




      285






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          Try the following, based on this answer by David Carlisle:



          documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}

          begin{document}

          section{Text before with original margins}
          some text here

          setlengthLTleft{-2cm} % adjust these to your liking
          setlengthLTright{-2cm}

          begin{tabularx}{linewidth}{llllllllllllllllllllllll}
          caption{Numbers}\hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabularx}

          noindent More text with original margins

          end{document}


          Which gives the following output:



          enter image description here






          share|improve this answer























          • Thank you, nice solution! :)
            – Roloka
            yesterday






          • 2




            Glad it helped. Would you like to accept an answer?
            – chrisma
            yesterday










          • It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
            – Roloka
            yesterday




















          up vote
          5
          down vote














          • do you really need table over more than one page?

          • using tabularx at least one column had to be of type X

          • using standard tabular* fit table in text area:


          enter image description here



          (red lines indicate border of text area)



              documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          % usepackage{ltablex}

          begin{document}

          begin{table}[htb]
          setlengthtabcolsep{0pt}
          caption{Numbers}
          noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabular*}
          end{table}
          end{document}


          solution as you ask in question, i.e. considering ltablex and expand text width locally (however, table should not be longer than one page):



          enter image description here



          (red lines indicate border of page layout)



              documentclass[a4paper, 12pt]{article}

          usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}
          keepXColumns

          usepackage[strict]{changepage}
          begin{document}

          begin{adjustwidth*}{}{-1.5cm}
          setlengthtabcolsep{3pt}
          begin{tabularx}{linewidth}{*{24}{X} }
          caption{Numbers} \
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
          end{tabularx}
          end{adjustwidth*}
          end{document}


          addendum:
          from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...



          if you like to have table width equal to text width, and for table use tabularx redefined by ltablex environment for equal width cells, than you need to make two changes in your mwe:




          • replace c column specifiers with X


          • in preamble add command keepXColumns, which will assure that X columns will behave the same as at standard tabularx (do you aware that using ltablex change standard features of tabularx?)



            documentclass[a4paper, 12pt]{article}
            usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
            usepackage{ltablex}
            keepXColumns

            begin{document}
            begin{tabularx}{linewidth}{*{9}{X} }
            caption{Numbers} \
            hline
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            end{tabularx}
            end{document}



          enter image description here



          (red lines indicate border of page layout)



          is this what you looking for?






          share|improve this answer























          • Yes, I need a table containing 200 rows and 9 wide columns.
            – Roloka
            yesterday










          • than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
            – Zarko
            yesterday












          • @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
            – Mico
            yesterday










          • It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
            – Roloka
            yesterday












          • @Roloka, see addendum to my answer.
            – Zarko
            yesterday











          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',
          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%2f463134%2fhow-to-change-margins-for-a-table-defined-in-tabularx-environment%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote



          accepted










          Try the following, based on this answer by David Carlisle:



          documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}

          begin{document}

          section{Text before with original margins}
          some text here

          setlengthLTleft{-2cm} % adjust these to your liking
          setlengthLTright{-2cm}

          begin{tabularx}{linewidth}{llllllllllllllllllllllll}
          caption{Numbers}\hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabularx}

          noindent More text with original margins

          end{document}


          Which gives the following output:



          enter image description here






          share|improve this answer























          • Thank you, nice solution! :)
            – Roloka
            yesterday






          • 2




            Glad it helped. Would you like to accept an answer?
            – chrisma
            yesterday










          • It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
            – Roloka
            yesterday

















          up vote
          4
          down vote



          accepted










          Try the following, based on this answer by David Carlisle:



          documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}

          begin{document}

          section{Text before with original margins}
          some text here

          setlengthLTleft{-2cm} % adjust these to your liking
          setlengthLTright{-2cm}

          begin{tabularx}{linewidth}{llllllllllllllllllllllll}
          caption{Numbers}\hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabularx}

          noindent More text with original margins

          end{document}


          Which gives the following output:



          enter image description here






          share|improve this answer























          • Thank you, nice solution! :)
            – Roloka
            yesterday






          • 2




            Glad it helped. Would you like to accept an answer?
            – chrisma
            yesterday










          • It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
            – Roloka
            yesterday















          up vote
          4
          down vote



          accepted







          up vote
          4
          down vote



          accepted






          Try the following, based on this answer by David Carlisle:



          documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}

          begin{document}

          section{Text before with original margins}
          some text here

          setlengthLTleft{-2cm} % adjust these to your liking
          setlengthLTright{-2cm}

          begin{tabularx}{linewidth}{llllllllllllllllllllllll}
          caption{Numbers}\hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabularx}

          noindent More text with original margins

          end{document}


          Which gives the following output:



          enter image description here






          share|improve this answer














          Try the following, based on this answer by David Carlisle:



          documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}

          begin{document}

          section{Text before with original margins}
          some text here

          setlengthLTleft{-2cm} % adjust these to your liking
          setlengthLTright{-2cm}

          begin{tabularx}{linewidth}{llllllllllllllllllllllll}
          caption{Numbers}\hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabularx}

          noindent More text with original margins

          end{document}


          Which gives the following output:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          chrisma

          777416




          777416












          • Thank you, nice solution! :)
            – Roloka
            yesterday






          • 2




            Glad it helped. Would you like to accept an answer?
            – chrisma
            yesterday










          • It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
            – Roloka
            yesterday




















          • Thank you, nice solution! :)
            – Roloka
            yesterday






          • 2




            Glad it helped. Would you like to accept an answer?
            – chrisma
            yesterday










          • It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
            – Roloka
            yesterday


















          Thank you, nice solution! :)
          – Roloka
          yesterday




          Thank you, nice solution! :)
          – Roloka
          yesterday




          2




          2




          Glad it helped. Would you like to accept an answer?
          – chrisma
          yesterday




          Glad it helped. Would you like to accept an answer?
          – chrisma
          yesterday












          It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
          – Roloka
          yesterday






          It would be more practical for me if I could use absolute margins (not related to the original ones). Can I do it somehow?
          – Roloka
          yesterday












          up vote
          5
          down vote














          • do you really need table over more than one page?

          • using tabularx at least one column had to be of type X

          • using standard tabular* fit table in text area:


          enter image description here



          (red lines indicate border of text area)



              documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          % usepackage{ltablex}

          begin{document}

          begin{table}[htb]
          setlengthtabcolsep{0pt}
          caption{Numbers}
          noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabular*}
          end{table}
          end{document}


          solution as you ask in question, i.e. considering ltablex and expand text width locally (however, table should not be longer than one page):



          enter image description here



          (red lines indicate border of page layout)



              documentclass[a4paper, 12pt]{article}

          usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}
          keepXColumns

          usepackage[strict]{changepage}
          begin{document}

          begin{adjustwidth*}{}{-1.5cm}
          setlengthtabcolsep{3pt}
          begin{tabularx}{linewidth}{*{24}{X} }
          caption{Numbers} \
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
          end{tabularx}
          end{adjustwidth*}
          end{document}


          addendum:
          from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...



          if you like to have table width equal to text width, and for table use tabularx redefined by ltablex environment for equal width cells, than you need to make two changes in your mwe:




          • replace c column specifiers with X


          • in preamble add command keepXColumns, which will assure that X columns will behave the same as at standard tabularx (do you aware that using ltablex change standard features of tabularx?)



            documentclass[a4paper, 12pt]{article}
            usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
            usepackage{ltablex}
            keepXColumns

            begin{document}
            begin{tabularx}{linewidth}{*{9}{X} }
            caption{Numbers} \
            hline
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            end{tabularx}
            end{document}



          enter image description here



          (red lines indicate border of page layout)



          is this what you looking for?






          share|improve this answer























          • Yes, I need a table containing 200 rows and 9 wide columns.
            – Roloka
            yesterday










          • than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
            – Zarko
            yesterday












          • @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
            – Mico
            yesterday










          • It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
            – Roloka
            yesterday












          • @Roloka, see addendum to my answer.
            – Zarko
            yesterday















          up vote
          5
          down vote














          • do you really need table over more than one page?

          • using tabularx at least one column had to be of type X

          • using standard tabular* fit table in text area:


          enter image description here



          (red lines indicate border of text area)



              documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          % usepackage{ltablex}

          begin{document}

          begin{table}[htb]
          setlengthtabcolsep{0pt}
          caption{Numbers}
          noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabular*}
          end{table}
          end{document}


          solution as you ask in question, i.e. considering ltablex and expand text width locally (however, table should not be longer than one page):



          enter image description here



          (red lines indicate border of page layout)



              documentclass[a4paper, 12pt]{article}

          usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}
          keepXColumns

          usepackage[strict]{changepage}
          begin{document}

          begin{adjustwidth*}{}{-1.5cm}
          setlengthtabcolsep{3pt}
          begin{tabularx}{linewidth}{*{24}{X} }
          caption{Numbers} \
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
          end{tabularx}
          end{adjustwidth*}
          end{document}


          addendum:
          from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...



          if you like to have table width equal to text width, and for table use tabularx redefined by ltablex environment for equal width cells, than you need to make two changes in your mwe:




          • replace c column specifiers with X


          • in preamble add command keepXColumns, which will assure that X columns will behave the same as at standard tabularx (do you aware that using ltablex change standard features of tabularx?)



            documentclass[a4paper, 12pt]{article}
            usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
            usepackage{ltablex}
            keepXColumns

            begin{document}
            begin{tabularx}{linewidth}{*{9}{X} }
            caption{Numbers} \
            hline
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            end{tabularx}
            end{document}



          enter image description here



          (red lines indicate border of page layout)



          is this what you looking for?






          share|improve this answer























          • Yes, I need a table containing 200 rows and 9 wide columns.
            – Roloka
            yesterday










          • than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
            – Zarko
            yesterday












          • @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
            – Mico
            yesterday










          • It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
            – Roloka
            yesterday












          • @Roloka, see addendum to my answer.
            – Zarko
            yesterday













          up vote
          5
          down vote










          up vote
          5
          down vote










          • do you really need table over more than one page?

          • using tabularx at least one column had to be of type X

          • using standard tabular* fit table in text area:


          enter image description here



          (red lines indicate border of text area)



              documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          % usepackage{ltablex}

          begin{document}

          begin{table}[htb]
          setlengthtabcolsep{0pt}
          caption{Numbers}
          noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabular*}
          end{table}
          end{document}


          solution as you ask in question, i.e. considering ltablex and expand text width locally (however, table should not be longer than one page):



          enter image description here



          (red lines indicate border of page layout)



              documentclass[a4paper, 12pt]{article}

          usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}
          keepXColumns

          usepackage[strict]{changepage}
          begin{document}

          begin{adjustwidth*}{}{-1.5cm}
          setlengthtabcolsep{3pt}
          begin{tabularx}{linewidth}{*{24}{X} }
          caption{Numbers} \
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
          end{tabularx}
          end{adjustwidth*}
          end{document}


          addendum:
          from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...



          if you like to have table width equal to text width, and for table use tabularx redefined by ltablex environment for equal width cells, than you need to make two changes in your mwe:




          • replace c column specifiers with X


          • in preamble add command keepXColumns, which will assure that X columns will behave the same as at standard tabularx (do you aware that using ltablex change standard features of tabularx?)



            documentclass[a4paper, 12pt]{article}
            usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
            usepackage{ltablex}
            keepXColumns

            begin{document}
            begin{tabularx}{linewidth}{*{9}{X} }
            caption{Numbers} \
            hline
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            end{tabularx}
            end{document}



          enter image description here



          (red lines indicate border of page layout)



          is this what you looking for?






          share|improve this answer















          • do you really need table over more than one page?

          • using tabularx at least one column had to be of type X

          • using standard tabular* fit table in text area:


          enter image description here



          (red lines indicate border of text area)



              documentclass[a4paper, 12pt]{article}
          usepackage[top=2.5cm,bottom=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          % usepackage{ltablex}

          begin{document}

          begin{table}[htb]
          setlengthtabcolsep{0pt}
          caption{Numbers}
          noindentbegin{tabular*}{linewidth}{@{extracolsep{fill}} *{24}{l}}
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          end{tabular*}
          end{table}
          end{document}


          solution as you ask in question, i.e. considering ltablex and expand text width locally (however, table should not be longer than one page):



          enter image description here



          (red lines indicate border of page layout)



              documentclass[a4paper, 12pt]{article}

          usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
          usepackage{ltablex}
          keepXColumns

          usepackage[strict]{changepage}
          begin{document}

          begin{adjustwidth*}{}{-1.5cm}
          setlengthtabcolsep{3pt}
          begin{tabularx}{linewidth}{*{24}{X} }
          caption{Numbers} \
          hline
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \
          1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & 21 & 22 & 23 & 24
          end{tabularx}
          end{adjustwidth*}
          end{document}


          addendum:
          from your comments below i conclude that your mwe, provided in question` is misleading, and question is therefore not clear at all. once you claim your table is 200 rows long and have only 9 columns, in a other that it hasn't 200 rows ...



          if you like to have table width equal to text width, and for table use tabularx redefined by ltablex environment for equal width cells, than you need to make two changes in your mwe:




          • replace c column specifiers with X


          • in preamble add command keepXColumns, which will assure that X columns will behave the same as at standard tabularx (do you aware that using ltablex change standard features of tabularx?)



            documentclass[a4paper, 12pt]{article}
            usepackage[vmargin=2.5cm,left=3.5cm,right=2.5cm]{geometry}
            usepackage{ltablex}
            keepXColumns

            begin{document}
            begin{tabularx}{linewidth}{*{9}{X} }
            caption{Numbers} \
            hline
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
            end{tabularx}
            end{document}



          enter image description here



          (red lines indicate border of page layout)



          is this what you looking for?







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          Zarko

          118k865155




          118k865155












          • Yes, I need a table containing 200 rows and 9 wide columns.
            – Roloka
            yesterday










          • than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
            – Zarko
            yesterday












          • @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
            – Mico
            yesterday










          • It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
            – Roloka
            yesterday












          • @Roloka, see addendum to my answer.
            – Zarko
            yesterday


















          • Yes, I need a table containing 200 rows and 9 wide columns.
            – Roloka
            yesterday










          • than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
            – Zarko
            yesterday












          • @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
            – Mico
            yesterday










          • It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
            – Roloka
            yesterday












          • @Roloka, see addendum to my answer.
            – Zarko
            yesterday
















          Yes, I need a table containing 200 rows and 9 wide columns.
          – Roloka
          yesterday




          Yes, I need a table containing 200 rows and 9 wide columns.
          – Roloka
          yesterday












          than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
          – Zarko
          yesterday






          than your table should not be wider than text width. it seems that you should consider to rotate table in landscape orientation ...
          – Zarko
          yesterday














          @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
          – Mico
          yesterday




          @Roloka - If you need to create a table with 9 columns, why did you provide code that creates 24, not 9, columns? And why did you "accept" the other answer, which is clearly incapable of creating a 200-row table?
          – Mico
          yesterday












          It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
          – Roloka
          yesterday






          It was not a request to create a 200-row table. The only goal was to change margins for the presented table without substantial modification of the example.
          – Roloka
          yesterday














          @Roloka, see addendum to my answer.
          – Zarko
          yesterday




          @Roloka, see addendum to my answer.
          – Zarko
          yesterday


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463134%2fhow-to-change-margins-for-a-table-defined-in-tabularx-environment%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          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

          Quarter-circle Tiles

          build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

          Mont Emei