I have many tables generated automatically in separated tex files which i input in my main document using

\input{table1} \input{table2} ...

Is it possible to refer to this table by using its name or in some other way, without going into each table1.tex (table2.tex etc...) and adding label?

  • 2
    Are they being generated in LaTeX form already? If so, why not have them autogenerate one more line, viz \label{<text>}? – jon Apr 14 '16 at 2:26
  • 1
    You could write a custom macro which would input the file and wrap the contents in a table environment, adding a caption and label. But the \label has to get into the table environment after \caption or inside the \caption. That is, you could have the autogeneration generate fewer lines rather than more. – cfr Apr 14 '16 at 2:26
  • pgfplotstable might be useful here, too – Sean Allred Apr 14 '16 at 4:07
  • you can try \input{table1}\label{tab:label} ...\input{table2}\label{tab:label} it can works – touhami Apr 14 '16 at 7:58
  • What is the structure of the file table1.tex? Knowing that one might be able to hook in to one of the commands it contains. – Andrew Swann Apr 14 '16 at 8:40