[Tex/LaTex] How to separate table content and table style


I want to know if there is a way to separate table / content for table style (think CSS).

Like to have only data specification

H1 & H2 & H3 & h4 \\
V1 & V2 & V3 & V4 \\

And then have the style somewhere to have the heading bold, the line filled, etc.

Best Answer

You can separate content and format in (La)TeX by defining your own logical format macros which are then (re)defined to the physical format macros required for each particular table.

For example the following table is used coded once but can be used with different styles. Normally the table might be in a user document or in a .tex file on its own and the styles could be placed in .sty files.



\begin{tabular}{1234} \beforeheading
V1 & V2 & V3 & V4 \\\normalline
V1 & V2 & V3 & V4 \\\normalline
V1 & V2 & V3 & V4 \\\lastline


% Default


% All rules


% Nice looking rules, centered cells




enter image description here

Related Question