alignemts](https://ftp.fau.de/ctan/macros/latex/contrib/tabularray/tabularray.pdf) of the tabularray package. For now all you need to know is, that this defines four columns for our table style and each column will align its text at the top left of the cell (indicated by t and l in the specifications for each column). Since we use the so called X column here, we also get automatic linebreaks in our table. If we dont want this, we would have to use the primitive Q column instead (replace all occurences of X with a Q in the `colspec`).# Changing behaviour of single rows, columns, cells and even moreSo we were able to set the width of our table, but what if I want to e.g. color the first row grey and all following uneven rows too, but in a different shade? Dont worry, all of this is very easy. We simply define these rows in our table style and are good to go: row{1} = { bg=grey9, fg=white, font=\bfseries, halign=c }, row{odd[3]} = { bg=grey5 }The same principle can be applied to columns, single cells and even single hlines and vlines: row{odd[3]} = {bg=gray9}, %% Change bg color of all odd rows starting with the third row column{2} = {halign=r}, %%align the second column to the right cell{4}{3} = {bg=red}, %% Change the bg color of the cell in the 4th row and third column hline{3}={dotted, red}, %%Change the way the third horizontal line gets renderedWe can also specify ranges of columns (etc). column{1-2} = {mode=text} %%changes the mode of the first two columns column{Z} = {mode=text} %%Change the mode of the last column column{3-Y} = {mode=math} %%changes the mode of each column except the first two and the last column# Using the table styleSo now that we know how to create our table style, how do we use it inside our org files? Sadly it seems like there is no way to directly set the enviroment of our tables to our custom enviroment (if you know a better solution please tell me), however there are a few tricks we can use. Using the \~\\renewenviroment\~ command from LaTeX, we can tell the LaTeX engine to replace the enviroment of all following tables to another enviroment (it can be used for more than tables, but we only care about tables here). Since the command only affects following enviroments, we can also use the command multiple times in a file to cycle between multiple layouts. Lets assume we have defined the table enviroments `globaltbl` and `nonglobaltbl`, then we could use the corresponding styles like the following: #+LATEX: \renewenvironment{tabular}{\begin{globaltbl}}{\end{globaltbl}} .... table 1 .... .... table 2 .... #+LATEX: \renewenvironment{tabular}{\begin{nonglobaltbl}}{\end{nonglobaltbl}} .... table 3 .... #+LATEX: \renewenvironment{tabular}{\begin{globaltbl}}{\end{globaltbl}} .... table 4 ....# Overriding preset valuesSo now that we have seen how to pre set values, how do we override them for a single table? Well, we just have to pass our table the corresponding arguemnts to the table. So if I as example want to set the color of a single cell in my table (lets say the top left cell) to red. Well, I simply add `#+attr_latex: :align cell{1}{1} = {bg=red}` to my table and Im good to go. Everything that we can specify in the inner definition of our enviroment, can be overwritten this way. Using this we can go absolutely wild with our tables, without affecting any other tables: #+attr_latex: :align row{2}={bg=blue,fg=white}, row{1}={fg=green, halign=l}, width=0.5\linewidth, hline{3}={text=<<<<<<<<<<, red} #+caption: Its always possible to override absolutely anything, while still using nonglobaltbl |-----------+-------------------+----------------------------------------------------------------------------------------| | Exit code | Type | Meaning |