Hi Ikumi, Ikumi Keita <ik...@ikumi.que.jp> writes:
>> 2 thing occurred to me when hitting `M-RET' in tabular environments: >> Current code in `LaTeX-array-count-columns' cannot handle multi column >> specs like `*{num}{spec}' and optional args to column specs S and s from >> siunitx.el. I have a patch to handle both issues. > > Instead of modifying LaTeX-array-count-columns, how about putting such > customized function in array.el and preparing to call it in a fashion > like > > (LaTeX-insert-ampersands > LaTeX-array-skipping-regexp 'NEW-FUNCTION-NAME) > > in TeX-add-style-hook? Syntaxes like > \begin{tabular}[t]{*{4}{l}l} > and Thanks for your response. This syntax is actually standard LaTeX, e.g.: \documentclass{article} \begin{document} \_ \begin{tabular}[t]{@{}*{2}{l}r} 1 & 2 & some longish text \\ 1 & 2 & some text \\ \hline \end{tabular} \_ \end{document} The lack of support for this was the main motivation for me to extend `LaTeX-array-count-columns'. > \begin{tabular}{X[foo = bar]} > are not supported in the standard LaTeX. If such enhancements continue > to pile up in future to cover syntaxes provided by other packages, > LaTeX-array-count-columns might become much complicated and be hard to > read and maintain. I agree. But I found that supporting this syntax inside `LaTeX-array-count-columns' was rather easy. > Of course such approach has drawbacks. As well as being redundant to > have similar codes at multiple locations, when someone improves > LaTeX-array-count-columns, that person has to look in all style/*.el > files and apply the same change to all the customized functions. > > So I won't object if you choose your original approach. How do you > think about that? I think we are not closing that door. If someone wants to write a style for tabu.sty, he/she can (and probably should) go the route you're suggesting. In general, I also think that `latex.el' should support vanilla LaTeX, but since the overhead for `\begin{tabular}{X[foo = bar]}' support is quite low, I think we can leave it in `LaTeX-array-count-columns'. I should also mention that one could write \documentclass{article} \begin{document} \_ \begin{tabular}[t]{@{}*2lr} 1 & 2 & some longish text \\ 1 & 2 & some text \\ \hline \end{tabular} \_ \end{document} Note the missing braces around 2 and l. While LaTeX compiles this happily, my code chokes due to missing braces. But I consider this a feature :-) WDYT? Best, Arash _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel