Is there a way to make something like tabular such that in a loop we get each column in a line and render them in a custom format. Like this
\begin{custom_tabular}
l1c1 & l1c2 & l1c3 \\
l2c1 & l2c2 & l2c3
\end{custom_tabular}
and render the the elements in a custom format, e.g.
\textbf{l1c1}: l1c2$^{l1c3}$
for all the lines. Expected output:
Best Answer
You can do this with the
collcell
package which allows you to pass the entry of each column to a command for further processing:Below I have defined two new column types. The
H
column type is for the header column, and theE
column type is for the exponent column. The middle column is just a normall
, but with a@{}
to remove the column separation between this column and the subsequent column containing the exponent.References:
A previous answer of mine customize the “cell environment” in a tabular also shows:
How to use the
array
package, which can definitely accommodate the header column withbut not sure how to get the superscript column to work.
A method which does not require any additional packages, by defining a macro to process each row. But, this requires changing each row of the table.
Code: