1

Is there a way I can save all my tabular formatted tables in a separate a file and call them wherever they are needed. This post discusses it for single table but I need for multiple.

Thanks

  • Hi, do you want them in the same file (all_tables.tbl) or in several files (table1.tbl, table2.tbl, ...)? Several files would be easier to work with IMHO, you could put them in a subfolder to not have a lot of extra files in the project directory. Both cases are possible to achieve though – Grimler Oct 13 '18 at 6:09
  • I want them in one single file. – pkj Oct 13 '18 at 6:18
  • I do not know what a .tbl file is. – pkj Oct 13 '18 at 6:26
  • @pkj each file can have the extension you choose. If you want to call a file foo.wobble go ahead and do so. Here tbl was chosen as the extension to tell the visitor of the containing folder that those are tables (tbl seems like an abbreviation for table, doesn't it?). – Skillmon Oct 13 '18 at 7:30
  • 1
    @pkj You could put every table in one file and surround each one with a Boolean construct, to make sure only that one is used when you input the file. But I think the needed infrastructure to do this isn't worth it. – Skillmon Oct 13 '18 at 7:31
4

There is nothing special about tables, it's possible to have a file (say mytables.sty) in which each table is defined to be a command say \mytableA,\mytableB etc (just surround the normal table markup by \newcommand\mytableB{....}

Then you can use \usepackage{mytables} and \mytableB in any document that needs \myTableB.

But if there are a lot of tables in the file you impose the time cost of reading the file, and the memory cost of storing all the definitions, and obscure the document by hiding the table content, so it isn't clearly a win.

  • thank you, it is very close to what I was expecting – pkj Oct 13 '18 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.