{"id":264,"date":"2012-12-17T05:31:00","date_gmt":"2012-12-17T05:31:00","guid":{"rendered":"https:\/\/pim.famnit.upr.si\/wp\/?p=264"},"modified":"2021-11-17T11:18:57","modified_gmt":"2021-11-17T11:18:57","slug":"latex-insert-a-pdf-table-as-an-image-in-a-table-environment","status":"publish","type":"post","link":"https:\/\/pim.famnit.upr.si\/wp\/?p=264","title":{"rendered":"LaTeX &#8211; insert a PDF table as an image in a table environment"},"content":{"rendered":"<p>On of the most painful (at least IMHO) things to create in LaTeX are complex or big tables. It is easier to make them in a spreadsheet software (Libreoffice Calc, MS Excel or even Word) and export them as PDFs (either File-&gt;Export as PDF, File-&gt;Save as or using <a href=\"http:\/\/sourceforge.net\/projects\/pdfcreator\/\">PDFCreator<\/a>). It is possible to <strong>insert PDFs as images in figure environment<\/strong> like this:<\/p>\n<style type=\"text\/css\">\np, li { white-space: pre-wra<\/style>\n<\/p>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#0000cc;\">\\begin<\/span><span style=\" color:#000000;\">{figure}[!<\/span><span style=\" color:#000000;\">ht<\/span><span style=\" color:#000000;\">]<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"> <span style=\" color:#0000cc;\">\\begin<\/span><span style=\" color:#000000;\">{center}                                      <\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">   <span style=\" font-weight:600; color:#0000cc;\">\\includegraphics<\/span><span style=\" color:#000000;\">[width=0.85<\/span><span style=\" color:#800000;\">\\textwidth<\/span><span style=\" color:#000000;\"><\/span><span style=\" color:#000000;\">]{images\/table-frameworks-overlap.pdf}                                                                  <\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#000000;\"> <\/span><span style=\" color:#0000cc;\">\\end<\/span><span style=\" color:#000000;\">{center}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#000000;\"> <\/span><span style=\" color:#800000;\">\\caption<\/span><span style=\" color:#000000;\">{Similarities and overlap between the two <\/span><span style=\" color:#000000;\">PIM<\/span><span style=\" color:#000000;\"> frameworks}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#000000;\"> <\/span><span style=\" font-weight:600; color:#0000cc;\">\\label<\/span><span style=\" color:#000000;\">{fig:table-frameworks-overlap}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#0000cc;\">\\end<\/span><span style=\" color:#000000;\">{figure}<\/span><\/pre>\n<p>However, <strong>this caption starts with the word &quot;Image X: &#8230;&quot;<\/strong> while I want to have a caption stating with &quot;Table X: &#8230;&quot;. <\/p>\n<p>It is possible to <strong>insert a PDF in a table environment<\/strong> as well like this:<\/p>\n<style type=\"text\/css\">\np, li { white-space: pre-wrap; }<\/style>\n<\/p>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#0000cc;\">\\begin<\/span><span style=\" color:#000000;\">{table}[<\/span><span style=\" color:#000000;\">ht<\/span><span style=\" color:#000000;\">]<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">  <span style=\" color:#800000;\">\\caption<\/span><span style=\" color:#000000;\">{A table}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">  <span style=\" color:#800000;\">\\centering<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">  <span style=\" color:#0000cc;\">\\begin<\/span><span style=\" color:#000000;\">{tabular}{c}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">    <span style=\" color:#0000cc;\">\\begin<\/span><span style=\" color:#000000;\">{center}                                                                         <\/span><span style=\" color:#606060;\"><\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">      <span style=\" font-weight:600; color:#0000cc;\">\\includegraphics<\/span><span style=\" color:#000000;\">[width=0.85<\/span><span style=\" color:#800000;\">\\textwidth<\/span><span style=\" color:#000000;\"><\/span><span style=\" color:#000000;\">]{images\/table-studies.pdf} <\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">    <span style=\" color:#0000cc;\">\\end<\/span><span style=\" color:#000000;\">{center}     <\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">  <span style=\" color:#0000cc;\">\\end<\/span><span style=\" color:#000000;\">{tabular}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\">  <span style=\" font-weight:600; color:#0000cc;\">\\label<\/span><span style=\" color:#000000;\">{tab:}<\/span><\/pre>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#0000cc;\">\\end<\/span><span style=\" color:#000000;\">{table}<\/span><\/pre>\n<p>If a PDF needs to be cropped you can do it like this:<\/p>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" font-weight:600; color:#0000cc;\"><span style=\" color:#606060;\">                                                       %left, bottom, right, top\r\n<\/span>\\includegraphics<\/span><span style=\" color:#000000;\">[width=0.85<\/span><span style=\" color:#800000;\">\\textwidth,<\/span><span style=\" color:#000000;\"> clip=true, trim=<\/span><span style=\" color:#000000;\">0cm<\/span><span style=\" color:#000000;\"> <\/span><span style=\" color:#000000;\">0cm<\/span><span style=\" color:#000000;\"> <\/span><span style=\" color:#000000;\">0cm<\/span><span style=\" color:#000000;\"> <\/span><span style=\" color:#000000;\">0cm<\/span><span style=\" color:#000000;\">]<\/span><\/pre>\n<p>You might also need the following package:<\/p>\n<style type=\"text\/css\">\np, li { white-space: pre-wra<\/style>\n<\/p>\n<pre style=\"margin: 0px; text-indent: 0px;\"><span style=\" color:#800000;\">\\usepackage<\/span><span style=\" color:#000000;\">{graphicx}<\/span><\/pre>\n<p><\/p>\n<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On of the most painful (at least IMHO) things to create in LaTeX are complex or big tables. It is easier to make them in a spreadsheet software (Libreoffice Calc, MS Excel or even Word) and export them as PDFs (either File-&gt;Export as PDF, File-&gt;Save as or using PDFCreator). It is possible to insert PDFs&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-4-software-hints"],"_links":{"self":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264"}],"version-history":[{"count":1,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions"}],"predecessor-version":[{"id":714,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=\/wp\/v2\/posts\/264\/revisions\/714"}],"wp:attachment":[{"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pim.famnit.upr.si\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}