0

I have a big table, which is hard to manage once I start filling in the cells. I would like to write something like \include{text_i_j} in each cell and write the corresponding code for the text outside of the table.

An example would look something like this:

\begin{center}
\begin{tabular}{| c | c | c |}
 \include{text_1_1} & \include{text_1_2} & \include{text_1_3} \\ 
 ...
 \include{text_10_1}  & \include{text_10_2} & \include{text_10_3}
\end{tabular}
\end{center}

\define{text_1_1} Text 1 1 \define{text_1_2} Text 1 2 ...

To get the following result:

enter image description here

How can I do this?

1 Answers1

0

\include is a command for including files, and always starts a new page.

Here you just want to define and use a command, but to allow use of row and column numbers, a simple wrapper command is used for defining and using the command for each cell.

enter image description here

\documentclass{article}
\newcommand\definecell[3]{\expandafter\def\csname tbl_#1_#2\endcsname{#3}}
\newcommand\tblcell[2]{\csname tbl_#1_#2\endcsname}

\begin{document}

\definecell{1}{1}{Text 1 1} \definecell{1}{2}{Text 1 2} \definecell{1}{3}{Text 1 3} \definecell{10}{1}{last row 1} \definecell{10}{2}{last row 2} \definecell{10}{3}{last row 3}

\begin{center} \begin{tabular}{| c | c | c |} \tblcell{1}{1} & \tblcell{1}{2} & \tblcell{1}{3} \ \tblcell{10}{1} & \tblcell{10}{2} & \tblcell{10}{3} \end{tabular} \end{center}

\end{document}

David Carlisle
  • 757,742