input - How to read body of table from a separate file? -
i want read/input body of table separate file. failed. how can it. below example
main tex file: main.tex
%main.tex \documentclass{article} \begin{document} table test. 1. insert total table \begin{tabular}{|c|c|} \hline & b \\ \hline c & d \\ \hline \end{tabular} 2. input body of table seperate file \begin{tabular}{|c|c|} \input{table} \end{tabular} \end{document}
table body file: table.tex
%table.tex \hline & b \\ \hline c & d \\ \hline
thank in advance
capture table contents in table.tex
in macro before processing within tabular
. this, utilize catchfile
package:
%main.tex \documentclass{article} \usepackage{filecontents,catchfile} \begin{filecontents*}{table.tex} %table.tex \hline & b \\ \hline c & d \\ \hline \end{filecontents*} \begin{document} table test. 1. insert total table \begin{tabular}{|c|c|} \hline & b \\ \hline c & d \\ \hline \end{tabular} 2. input body of table seperate file \catchfiledef{\mytable}{table.tex}{}% table.tex > \mytable \begin{tabular}{|c|c|} \mytable \end{tabular} \end{document}
table input latex
No comments:
Post a Comment