When using LaTeX, I typically want to use the indenting support provided by AucTeX/LaTeX-mode. However, I've recently written a number of tables like these:
\begin{tabular}{l@{}c@{}c@{}c} Header1 & \multicolumn{1}{c}{Test1} & \multicolumn{1}{c}{Test2} & \multicolumn{1}{c}{Test3} \\ \rowcolor{gray!10} \multicolumn{1}{c}{Testing...} & {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} & {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} & % <---- {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} \\ \end{tabular} When I attempt to indent this table (using, e.g., indent-region) or even just adding a new line by using C-j with point at the location marked with % <----, this is indented as:
\begin{tabular}{l@{}c@{}c@{}c} Header1 & \multicolumn{1}{c}{Test1} & \multicolumn{1}{c}{Test2} & \multicolumn{1}{c}{Test3} \\ \rowcolor{gray!10} \multicolumn{1}{c}{Testing...} & {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} & {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} & {\begin{minipage}{2cm}\includegraphics[width=2cm]{example-image-a}\end{minipage}} \\ \end{tabular} Which, of course is correct if you want to align all columns, but which is clearly not desirable in this case.
One solution is simple to disable the indentation for these environments, e.g., with:
(with-eval-after-load 'latex (add-to-list 'LaTeX-indent-environment-list '("tabular" . nil)) (add-to-list 'LaTeX-indent-environment-list '("tabularx" . nil)) (add-to-list 'LaTeX-indent-environment-list '("tabu" . nil))) But as stated, I would still like to perform the indentation as usual in most tables; is there something I can do to configure this?
(One final option is to add a new environment in TeX that simply aliases existing ones, however, I would like to avoid that, since some publishers don't even want us to use \newcommand anymore)