auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] Extending `LaTeX-array-count-columns'


From: Arash Esbati
Subject: Re: [AUCTeX-devel] Extending `LaTeX-array-count-columns'
Date: Wed, 14 Dec 2016 19:57:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1

Hi Ikumi,

Ikumi Keita <address@hidden> 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}
    \_
    address@hidden
      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}
    \_
    address@hidden
      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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]