Using longtable for figures: the figures overlap with horizontal and vertical lines











up vote
0
down vote

favorite












I have a huge number of plots that I want to insert in longtable to make a figure table, possibly ranging several pages.



However I am not able to scale the figures inside each table cell in such a way that they do not overlap with horizontal and vertical lines in the table. If I simply reduce the width of each table cell, the cell and the figure are reduced the same factor and the figure still overlaps with the lines.



Can anybody help me with a code change that avoiding this overlap?



In addition, how do I place the "figure lacking" text in the middle of their cells, horizontally and vertically?



Thanks in advance!



EDIT: I am not able to correctly format my code lines in this window. I am using Ctr-K and four spaces. How to do this correctly?



enter image description here



documentclass[9pt,a4paper,twosided]{article}
usepackage{longtable}
usepackage{graphicx}
begin{document}
begin{longtable}{|c|c|c|}
caption{My caption for figures in longtable}
label{figtab-1B}\%
hline
multicolumn{3}{c}{The table heading of the first page}\%
hline
endfirsthead
multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
hline
multicolumn{3}{c}{The table heading for the next pages}\%
hline
endhead
hline hline
multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
endfoot
hline
endlastfoot
includegraphics[width=0.33textwidth]{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}&
figure lacking&
includegraphics[width=0.33textwidth]{./figures/1B_-_Ammonium_(NH4-N).jpg}\%
hline
includegraphics[width=0.33textwidth]{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}&
figure lacking\
hline
includegraphics[width=0.33textwidth]{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}&
figure lacking&
includegraphics[width=0.33textwidth]{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg}\%
hline
includegraphics[width=0.33textwidth]{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Krysen_slash_Trifenylen.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Naftalen.jpg}\%
hline
includegraphics[width=0.33textwidth]{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Pyren.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg}\%
hline
includegraphics[width=0.33textwidth]{./figures/1B_-_Suspendert_stoff.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Fosfor.jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Nitrogen.jpg}\%
hline
includegraphics[width=0.33textwidth]{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}&
includegraphics[width=0.33textwidth]{./figures/1B_-_Turbiditet.jpg}\%
end{longtable}
end{document}









share|improve this question




























    up vote
    0
    down vote

    favorite












    I have a huge number of plots that I want to insert in longtable to make a figure table, possibly ranging several pages.



    However I am not able to scale the figures inside each table cell in such a way that they do not overlap with horizontal and vertical lines in the table. If I simply reduce the width of each table cell, the cell and the figure are reduced the same factor and the figure still overlaps with the lines.



    Can anybody help me with a code change that avoiding this overlap?



    In addition, how do I place the "figure lacking" text in the middle of their cells, horizontally and vertically?



    Thanks in advance!



    EDIT: I am not able to correctly format my code lines in this window. I am using Ctr-K and four spaces. How to do this correctly?



    enter image description here



    documentclass[9pt,a4paper,twosided]{article}
    usepackage{longtable}
    usepackage{graphicx}
    begin{document}
    begin{longtable}{|c|c|c|}
    caption{My caption for figures in longtable}
    label{figtab-1B}\%
    hline
    multicolumn{3}{c}{The table heading of the first page}\%
    hline
    endfirsthead
    multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
    hline
    multicolumn{3}{c}{The table heading for the next pages}\%
    hline
    endhead
    hline hline
    multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
    endfoot
    hline
    endlastfoot
    includegraphics[width=0.33textwidth]{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}&
    figure lacking&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Ammonium_(NH4-N).jpg}\%
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}&
    figure lacking\
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}&
    figure lacking&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg}\%
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Krysen_slash_Trifenylen.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Naftalen.jpg}\%
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Pyren.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg}\%
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_-_Suspendert_stoff.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Fosfor.jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Nitrogen.jpg}\%
    hline
    includegraphics[width=0.33textwidth]{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}&
    includegraphics[width=0.33textwidth]{./figures/1B_-_Turbiditet.jpg}\%
    end{longtable}
    end{document}









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a huge number of plots that I want to insert in longtable to make a figure table, possibly ranging several pages.



      However I am not able to scale the figures inside each table cell in such a way that they do not overlap with horizontal and vertical lines in the table. If I simply reduce the width of each table cell, the cell and the figure are reduced the same factor and the figure still overlaps with the lines.



      Can anybody help me with a code change that avoiding this overlap?



      In addition, how do I place the "figure lacking" text in the middle of their cells, horizontally and vertically?



      Thanks in advance!



      EDIT: I am not able to correctly format my code lines in this window. I am using Ctr-K and four spaces. How to do this correctly?



      enter image description here



      documentclass[9pt,a4paper,twosided]{article}
      usepackage{longtable}
      usepackage{graphicx}
      begin{document}
      begin{longtable}{|c|c|c|}
      caption{My caption for figures in longtable}
      label{figtab-1B}\%
      hline
      multicolumn{3}{c}{The table heading of the first page}\%
      hline
      endfirsthead
      multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
      hline
      multicolumn{3}{c}{The table heading for the next pages}\%
      hline
      endhead
      hline hline
      multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
      endfoot
      hline
      endlastfoot
      includegraphics[width=0.33textwidth]{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}&
      figure lacking&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Ammonium_(NH4-N).jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}&
      figure lacking\
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}&
      figure lacking&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Krysen_slash_Trifenylen.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Naftalen.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Pyren.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Suspendert_stoff.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Fosfor.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Nitrogen.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Turbiditet.jpg}\%
      end{longtable}
      end{document}









      share|improve this question















      I have a huge number of plots that I want to insert in longtable to make a figure table, possibly ranging several pages.



      However I am not able to scale the figures inside each table cell in such a way that they do not overlap with horizontal and vertical lines in the table. If I simply reduce the width of each table cell, the cell and the figure are reduced the same factor and the figure still overlaps with the lines.



      Can anybody help me with a code change that avoiding this overlap?



      In addition, how do I place the "figure lacking" text in the middle of their cells, horizontally and vertically?



      Thanks in advance!



      EDIT: I am not able to correctly format my code lines in this window. I am using Ctr-K and four spaces. How to do this correctly?



      enter image description here



      documentclass[9pt,a4paper,twosided]{article}
      usepackage{longtable}
      usepackage{graphicx}
      begin{document}
      begin{longtable}{|c|c|c|}
      caption{My caption for figures in longtable}
      label{figtab-1B}\%
      hline
      multicolumn{3}{c}{The table heading of the first page}\%
      hline
      endfirsthead
      multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
      hline
      multicolumn{3}{c}{The table heading for the next pages}\%
      hline
      endhead
      hline hline
      multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
      endfoot
      hline
      endlastfoot
      includegraphics[width=0.33textwidth]{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}&
      figure lacking&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Ammonium_(NH4-N).jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}&
      figure lacking\
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}&
      figure lacking&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Krysen_slash_Trifenylen.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Naftalen.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Pyren.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_-_Suspendert_stoff.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Fosfor.jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Total_Nitrogen.jpg}\%
      hline
      includegraphics[width=0.33textwidth]{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}&
      includegraphics[width=0.33textwidth]{./figures/1B_-_Turbiditet.jpg}\%
      end{longtable}
      end{document}






      longtable






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 5 at 20:33









      Zarko

      119k865155




      119k865155










      asked Dec 5 at 20:19









      myotis

      4631314




      4631314






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          documentclass[9pt,a4paper,twosided]{article}
          usepackage{longtable}
          usepackage[demo,
          export]{adjustbox}
          usepackage{etoolbox}

          %-------------------------------------- only for show page layout
          usepackage{showframe}
          renewcommandShowFrameLinethickness{0.25pt}
          renewcommand*ShowFrameColor{color{red}}
          %---------------------------------------------------------------%

          begin{document}
          begingroup
          expandafterpatchcmdcsname Gin@iiendcsname % needed etoolbox
          {setkeys{Gin}{#1}}%
          {setkeys{Gin}%
          {width=0.3linewidth,% % standard graphicx settings
          valign=c, margin=0pt 3pt 0pt 3pt,#1}% % settings from adjustbox
          }
          {}{}
          setlengthtabcolsep{5pt}
          setlengthtabcolsep{3pt}
          begin{longtable}{|c|c|c|}
          caption{My caption for figures in longtable}
          label{figtab-1B}\%
          hline
          multicolumn{3}{c}{The table heading of the first page}\%
          hline
          endfirsthead
          multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
          hline
          multicolumn{3}{c}{The table heading for the next pages}\%
          hline
          endhead
          hline hline
          multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
          endfoot
          hline
          endlastfoot
          includegraphics{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Ammonium_(NH4-N).jpg} \
          hline
          includegraphics{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking \
          hline
          includegraphics{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Krysen_slash_Trifenylen.jpg}
          & includegraphics{./figures/1B_-_Naftalen.jpg} \
          hline
          includegraphics{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Pyren.jpg}
          & includegraphics{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Suspendert_stoff.jpg}
          & includegraphics{./figures/1B_-_Total_Fosfor.jpg}
          & includegraphics{./figures/1B_-_Total_Nitrogen.jpg} \
          hline
          includegraphics{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}
          & includegraphics{./figures/1B_-_Turbiditet.jpg}
          & \
          end{longtable}
          endgroup
          end{document}


          enter image description here






          share|improve this answer























          • Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
            – myotis
            Dec 5 at 21:25










          • longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
            – Zarko
            Dec 5 at 21:37












          • Thanks a lot! You saved my life just now :)
            – myotis
            Dec 6 at 12:58


















          up vote
          0
          down vote













          Add this to your preamble:



          usepackage{cellspace}
          setlength{cellspacetoplimit}{3pt}
          setlength{cellspacebottomlimit}{3pt}


          and the first line of the longtable code with



          begin{longtable}{|Sc|Sc|Sc|}


          (if you load siunitx replace Sc with Cc).






          share|improve this answer





















          • Thanks! but my MikTex does not find the cellspace.sty file for some reason
            – myotis
            Dec 6 at 12:56










          • Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
            – Bernard
            Dec 6 at 15:44










          • Yes I installed it, by using your code.
            – myotis
            Dec 6 at 15:50










          • And the code removes the overlapping?
            – Bernard
            Dec 6 at 16:54










          • No, I still get this error message about not finding the cellspace.sty.
            – myotis
            Dec 6 at 17:15











          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%2f463383%2fusing-longtable-for-figures-the-figures-overlap-with-horizontal-and-vertical-li%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
          1
          down vote



          accepted










          documentclass[9pt,a4paper,twosided]{article}
          usepackage{longtable}
          usepackage[demo,
          export]{adjustbox}
          usepackage{etoolbox}

          %-------------------------------------- only for show page layout
          usepackage{showframe}
          renewcommandShowFrameLinethickness{0.25pt}
          renewcommand*ShowFrameColor{color{red}}
          %---------------------------------------------------------------%

          begin{document}
          begingroup
          expandafterpatchcmdcsname Gin@iiendcsname % needed etoolbox
          {setkeys{Gin}{#1}}%
          {setkeys{Gin}%
          {width=0.3linewidth,% % standard graphicx settings
          valign=c, margin=0pt 3pt 0pt 3pt,#1}% % settings from adjustbox
          }
          {}{}
          setlengthtabcolsep{5pt}
          setlengthtabcolsep{3pt}
          begin{longtable}{|c|c|c|}
          caption{My caption for figures in longtable}
          label{figtab-1B}\%
          hline
          multicolumn{3}{c}{The table heading of the first page}\%
          hline
          endfirsthead
          multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
          hline
          multicolumn{3}{c}{The table heading for the next pages}\%
          hline
          endhead
          hline hline
          multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
          endfoot
          hline
          endlastfoot
          includegraphics{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Ammonium_(NH4-N).jpg} \
          hline
          includegraphics{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking \
          hline
          includegraphics{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Krysen_slash_Trifenylen.jpg}
          & includegraphics{./figures/1B_-_Naftalen.jpg} \
          hline
          includegraphics{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Pyren.jpg}
          & includegraphics{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Suspendert_stoff.jpg}
          & includegraphics{./figures/1B_-_Total_Fosfor.jpg}
          & includegraphics{./figures/1B_-_Total_Nitrogen.jpg} \
          hline
          includegraphics{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}
          & includegraphics{./figures/1B_-_Turbiditet.jpg}
          & \
          end{longtable}
          endgroup
          end{document}


          enter image description here






          share|improve this answer























          • Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
            – myotis
            Dec 5 at 21:25










          • longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
            – Zarko
            Dec 5 at 21:37












          • Thanks a lot! You saved my life just now :)
            – myotis
            Dec 6 at 12:58















          up vote
          1
          down vote



          accepted










          documentclass[9pt,a4paper,twosided]{article}
          usepackage{longtable}
          usepackage[demo,
          export]{adjustbox}
          usepackage{etoolbox}

          %-------------------------------------- only for show page layout
          usepackage{showframe}
          renewcommandShowFrameLinethickness{0.25pt}
          renewcommand*ShowFrameColor{color{red}}
          %---------------------------------------------------------------%

          begin{document}
          begingroup
          expandafterpatchcmdcsname Gin@iiendcsname % needed etoolbox
          {setkeys{Gin}{#1}}%
          {setkeys{Gin}%
          {width=0.3linewidth,% % standard graphicx settings
          valign=c, margin=0pt 3pt 0pt 3pt,#1}% % settings from adjustbox
          }
          {}{}
          setlengthtabcolsep{5pt}
          setlengthtabcolsep{3pt}
          begin{longtable}{|c|c|c|}
          caption{My caption for figures in longtable}
          label{figtab-1B}\%
          hline
          multicolumn{3}{c}{The table heading of the first page}\%
          hline
          endfirsthead
          multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
          hline
          multicolumn{3}{c}{The table heading for the next pages}\%
          hline
          endhead
          hline hline
          multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
          endfoot
          hline
          endlastfoot
          includegraphics{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Ammonium_(NH4-N).jpg} \
          hline
          includegraphics{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking \
          hline
          includegraphics{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Krysen_slash_Trifenylen.jpg}
          & includegraphics{./figures/1B_-_Naftalen.jpg} \
          hline
          includegraphics{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Pyren.jpg}
          & includegraphics{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Suspendert_stoff.jpg}
          & includegraphics{./figures/1B_-_Total_Fosfor.jpg}
          & includegraphics{./figures/1B_-_Total_Nitrogen.jpg} \
          hline
          includegraphics{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}
          & includegraphics{./figures/1B_-_Turbiditet.jpg}
          & \
          end{longtable}
          endgroup
          end{document}


          enter image description here






          share|improve this answer























          • Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
            – myotis
            Dec 5 at 21:25










          • longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
            – Zarko
            Dec 5 at 21:37












          • Thanks a lot! You saved my life just now :)
            – myotis
            Dec 6 at 12:58













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          documentclass[9pt,a4paper,twosided]{article}
          usepackage{longtable}
          usepackage[demo,
          export]{adjustbox}
          usepackage{etoolbox}

          %-------------------------------------- only for show page layout
          usepackage{showframe}
          renewcommandShowFrameLinethickness{0.25pt}
          renewcommand*ShowFrameColor{color{red}}
          %---------------------------------------------------------------%

          begin{document}
          begingroup
          expandafterpatchcmdcsname Gin@iiendcsname % needed etoolbox
          {setkeys{Gin}{#1}}%
          {setkeys{Gin}%
          {width=0.3linewidth,% % standard graphicx settings
          valign=c, margin=0pt 3pt 0pt 3pt,#1}% % settings from adjustbox
          }
          {}{}
          setlengthtabcolsep{5pt}
          setlengthtabcolsep{3pt}
          begin{longtable}{|c|c|c|}
          caption{My caption for figures in longtable}
          label{figtab-1B}\%
          hline
          multicolumn{3}{c}{The table heading of the first page}\%
          hline
          endfirsthead
          multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
          hline
          multicolumn{3}{c}{The table heading for the next pages}\%
          hline
          endhead
          hline hline
          multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
          endfoot
          hline
          endlastfoot
          includegraphics{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Ammonium_(NH4-N).jpg} \
          hline
          includegraphics{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking \
          hline
          includegraphics{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Krysen_slash_Trifenylen.jpg}
          & includegraphics{./figures/1B_-_Naftalen.jpg} \
          hline
          includegraphics{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Pyren.jpg}
          & includegraphics{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Suspendert_stoff.jpg}
          & includegraphics{./figures/1B_-_Total_Fosfor.jpg}
          & includegraphics{./figures/1B_-_Total_Nitrogen.jpg} \
          hline
          includegraphics{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}
          & includegraphics{./figures/1B_-_Turbiditet.jpg}
          & \
          end{longtable}
          endgroup
          end{document}


          enter image description here






          share|improve this answer














          documentclass[9pt,a4paper,twosided]{article}
          usepackage{longtable}
          usepackage[demo,
          export]{adjustbox}
          usepackage{etoolbox}

          %-------------------------------------- only for show page layout
          usepackage{showframe}
          renewcommandShowFrameLinethickness{0.25pt}
          renewcommand*ShowFrameColor{color{red}}
          %---------------------------------------------------------------%

          begin{document}
          begingroup
          expandafterpatchcmdcsname Gin@iiendcsname % needed etoolbox
          {setkeys{Gin}{#1}}%
          {setkeys{Gin}%
          {width=0.3linewidth,% % standard graphicx settings
          valign=c, margin=0pt 3pt 0pt 3pt,#1}% % settings from adjustbox
          }
          {}{}
          setlengthtabcolsep{5pt}
          setlengthtabcolsep{3pt}
          begin{longtable}{|c|c|c|}
          caption{My caption for figures in longtable}
          label{figtab-1B}\%
          hline
          multicolumn{3}{c}{The table heading of the first page}\%
          hline
          endfirsthead
          multicolumn{3}{c}{tablename thetable -- textit{Continued from last page}}\%
          hline
          multicolumn{3}{c}{The table heading for the next pages}\%
          hline
          endhead
          hline hline
          multicolumn{3}{c}{tablename thetable -- textit{To be continued on the next page}} \%
          endfoot
          hline
          endlastfoot
          includegraphics{./figures/1B_-_Alkalitet_til_pH_4_comma_5.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Ammonium_(NH4-N).jpg} \
          hline
          includegraphics{./figures/1B_-_Arsen_(As)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Bly_(Pb)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking \
          hline
          includegraphics{./figures/1B_-_Kadmium_(Cd)_comma_oppsluttet_ICP-MS.jpg}
          & figure lacking
          & includegraphics{./figures/1B_-_Kobber_(Cu)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Krom_(Cr)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Krysen_slash_Trifenylen.jpg}
          & includegraphics{./figures/1B_-_Naftalen.jpg} \
          hline
          includegraphics{./figures/1B_-_Nikkel_(Ni)_comma_oppsluttet_ICP-MS.jpg}
          & includegraphics{./figures/1B_-_Pyren.jpg}
          & includegraphics{./figures/1B_-_Sink_(Zn)_comma_oppsluttet_ICP-MS.jpg} \
          hline
          includegraphics{./figures/1B_-_Suspendert_stoff.jpg}
          & includegraphics{./figures/1B_-_Total_Fosfor.jpg}
          & includegraphics{./figures/1B_-_Total_Nitrogen.jpg} \
          hline
          includegraphics{./figures/1B_- _Total_organisk_karbon_(TOC_slash_NPOC).jpg}
          & includegraphics{./figures/1B_-_Turbiditet.jpg}
          & \
          end{longtable}
          endgroup
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 5 at 22:22

























          answered Dec 5 at 20:48









          Zarko

          119k865155




          119k865155












          • Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
            – myotis
            Dec 5 at 21:25










          • longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
            – Zarko
            Dec 5 at 21:37












          • Thanks a lot! You saved my life just now :)
            – myotis
            Dec 6 at 12:58


















          • Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
            – myotis
            Dec 5 at 21:25










          • longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
            – Zarko
            Dec 5 at 21:37












          • Thanks a lot! You saved my life just now :)
            – myotis
            Dec 6 at 12:58
















          Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
          – myotis
          Dec 5 at 21:25




          Thanks. This looks promissing. I tried to put a begin{center}...end{center} environment on the outside of the begingroup...endgroup environment, but the figure table would not center horizontally on the page. How can I make it center horizontally?
          – myotis
          Dec 5 at 21:25












          longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
          – Zarko
          Dec 5 at 21:37






          longtable is centered (by default) in text area.begingroup, endgroup˙ in my mwe only limited Gin˙ to longtable, in case of use begin{center} ... end{center} can be omitted. to my answer i will add lines which show page layout.
          – Zarko
          Dec 5 at 21:37














          Thanks a lot! You saved my life just now :)
          – myotis
          Dec 6 at 12:58




          Thanks a lot! You saved my life just now :)
          – myotis
          Dec 6 at 12:58










          up vote
          0
          down vote













          Add this to your preamble:



          usepackage{cellspace}
          setlength{cellspacetoplimit}{3pt}
          setlength{cellspacebottomlimit}{3pt}


          and the first line of the longtable code with



          begin{longtable}{|Sc|Sc|Sc|}


          (if you load siunitx replace Sc with Cc).






          share|improve this answer





















          • Thanks! but my MikTex does not find the cellspace.sty file for some reason
            – myotis
            Dec 6 at 12:56










          • Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
            – Bernard
            Dec 6 at 15:44










          • Yes I installed it, by using your code.
            – myotis
            Dec 6 at 15:50










          • And the code removes the overlapping?
            – Bernard
            Dec 6 at 16:54










          • No, I still get this error message about not finding the cellspace.sty.
            – myotis
            Dec 6 at 17:15















          up vote
          0
          down vote













          Add this to your preamble:



          usepackage{cellspace}
          setlength{cellspacetoplimit}{3pt}
          setlength{cellspacebottomlimit}{3pt}


          and the first line of the longtable code with



          begin{longtable}{|Sc|Sc|Sc|}


          (if you load siunitx replace Sc with Cc).






          share|improve this answer





















          • Thanks! but my MikTex does not find the cellspace.sty file for some reason
            – myotis
            Dec 6 at 12:56










          • Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
            – Bernard
            Dec 6 at 15:44










          • Yes I installed it, by using your code.
            – myotis
            Dec 6 at 15:50










          • And the code removes the overlapping?
            – Bernard
            Dec 6 at 16:54










          • No, I still get this error message about not finding the cellspace.sty.
            – myotis
            Dec 6 at 17:15













          up vote
          0
          down vote










          up vote
          0
          down vote









          Add this to your preamble:



          usepackage{cellspace}
          setlength{cellspacetoplimit}{3pt}
          setlength{cellspacebottomlimit}{3pt}


          and the first line of the longtable code with



          begin{longtable}{|Sc|Sc|Sc|}


          (if you load siunitx replace Sc with Cc).






          share|improve this answer












          Add this to your preamble:



          usepackage{cellspace}
          setlength{cellspacetoplimit}{3pt}
          setlength{cellspacebottomlimit}{3pt}


          and the first line of the longtable code with



          begin{longtable}{|Sc|Sc|Sc|}


          (if you load siunitx replace Sc with Cc).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 5 at 20:46









          Bernard

          164k769192




          164k769192












          • Thanks! but my MikTex does not find the cellspace.sty file for some reason
            – myotis
            Dec 6 at 12:56










          • Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
            – Bernard
            Dec 6 at 15:44










          • Yes I installed it, by using your code.
            – myotis
            Dec 6 at 15:50










          • And the code removes the overlapping?
            – Bernard
            Dec 6 at 16:54










          • No, I still get this error message about not finding the cellspace.sty.
            – myotis
            Dec 6 at 17:15


















          • Thanks! but my MikTex does not find the cellspace.sty file for some reason
            – myotis
            Dec 6 at 12:56










          • Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
            – Bernard
            Dec 6 at 15:44










          • Yes I installed it, by using your code.
            – myotis
            Dec 6 at 15:50










          • And the code removes the overlapping?
            – Bernard
            Dec 6 at 16:54










          • No, I still get this error message about not finding the cellspace.sty.
            – myotis
            Dec 6 at 17:15
















          Thanks! but my MikTex does not find the cellspace.sty file for some reason
          – myotis
          Dec 6 at 12:56




          Thanks! but my MikTex does not find the cellspace.sty file for some reason
          – myotis
          Dec 6 at 12:56












          Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
          – Bernard
          Dec 6 at 15:44




          Did you install it? It's not installed by default (do that with MiKTeX Package Manager).
          – Bernard
          Dec 6 at 15:44












          Yes I installed it, by using your code.
          – myotis
          Dec 6 at 15:50




          Yes I installed it, by using your code.
          – myotis
          Dec 6 at 15:50












          And the code removes the overlapping?
          – Bernard
          Dec 6 at 16:54




          And the code removes the overlapping?
          – Bernard
          Dec 6 at 16:54












          No, I still get this error message about not finding the cellspace.sty.
          – myotis
          Dec 6 at 17:15




          No, I still get this error message about not finding the cellspace.sty.
          – myotis
          Dec 6 at 17:15


















          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%2f463383%2fusing-longtable-for-figures-the-figures-overlap-with-horizontal-and-vertical-li%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