auctex
[Top][All Lists]
Advanced

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

Re: Some LaTeX commands, such as \boldsymbol and \hspace, can't be compl


From: Arash Esbati
Subject: Re: Some LaTeX commands, such as \boldsymbol and \hspace, can't be completed in AUCTeX.
Date: Thu, 09 Dec 2021 18:41:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Denis Bitouzé <denis.bitouze@univ-littoral.fr> writes:

> Le 09/12/21 à 12h44, Arash Esbati a écrit :
>
>> You can always drop a line to auctex-devel asking for an addition.  Or
>> even better provide code for the missing package/command.  I think for
>> most of packages out there providing only user macros it's not hard to
>> write AUCTeX styles.
>
> Agree, but tedious. That's why I proposed to benefit from the `.cwl`
> completion files of TXS: it's also probably not so hard to provide
> a converter (maybe I will have a look when I'll have some spare time).

Highly welcome.  There will be a question reg. licence, but we can be
worried about that later.

> Agree but, in case of `\includegraphics`, I would say the `width` or
> `height` options are mandatory ;) It is indeed usual to want the
> included graphic to not be at its natural dimensions (and, often, the
> user doesn't know these dimensions).

Agreed, but \includegraphics is indeed more an exception.

>> Why do start to type after 'width='.  Just hit TAB and the backslash is
>> inserted in the minibuffer and you can go on with 'l TAB'.
>
> Ah, OK but that's not easy to figure out. IMO, if `width` is chosen and
> obtained by completion, it should completed into `width=`.

True, but then again this is by design that you give Emacs a hint about
your selection -- you could take the completion 'width' and extend it to
'widthfoo'.

>> While we're at it, does TXS has something like `C-c C-m' or does it
>> inline completion like company for Emacs where you start typing and get
>> a drop-down list to select of?  I admit I've never used anything else
>> than (X)Emacs so I don't know.
>
> It provides inline completion, which is IMO much easier to use. For
> instance about `\includegraphics`, if you type `\includeg`, the
> following appears in the TXS' completion window:
>
>   ┌────
>   │ \includegraphics{imagefile}
>   │ \includegraphics[keyvals]{imagefile}
>   │ \includegraphics*{imagefile}
>   │ \includegraphics*[keyvals]{imagefile}
>   └────

Ok, understood, so more like company.  For me, the way AUCTeX handles
the completion was always great because I didn't need to hit the
backslash which is hard to reach on a German keyboard.  I thought it is
the same issue on French layout?

> If you choose the second entry, `keyvals` is immediately selected and if
> you type `w`, you're immediately prompted with `width=` in the
> completion window ; if you accept it (RET), `width=` is written (with
> the cursor just after `=`) and you're immediately prompted with:
>
>   ┌────
>   │ \linewidth
>   │ \textheight
>   └────
>
> (OK, last option is a bit odd for a width) in the completion window ; at
> this stage, either you choose one of the propositions or you start to
> type something else (e.g. `15cm`).

I see, this can be useful.  Maybe we should extend the completion at
point in AUCTeX, I'm not familiar with it, though.

> Another interesting feature provided by TXS is wizards. For instance for
> the floating figures, a pop up window appears with all what the user might
> want for such floats:
>
>   ┌────
>
> https://htmlpreview.github.io/?https://github.com/texstudio-org/texstudio/master/utilities/manual/usermanual_en.html#SECTION110a
>   └────
>
> From this point of view, `C-c C-e fig TAB RET` is much less rich but,
> more generally, with all done in the minibuffer by AUCTeX, the user
> doesn't have an general overview of the different fields it has to fill
> and, to a certain extent, fills them blindly (`C-c C-e minipage RET` is
> a typical example): by contrast, in the TXS wizard, he can look at each
> field at his own rhythm.
>
> I know pop up windows such as the TXS ones is not the way Emacs is
> working, but such a feature might be approximated with something à la
> yasnippet with placeholders (some of these placeholders providing
> completions).

I thinks nowadays people use the table features in org-mode and then
export them.

>> That's one impressive number.  But again, dropping a line to
>> auctex-devel requesting a package or better providing code directly is
>> the best way to increase the number styles provided by AUCTeX.
>
> Better to write a converter from `.cwl` to AUCTeX completion files :)

See above :-)

> WDYT about my examples in:
>
>   ┌────
>https://lists.gnu.org/archive/html/auctex/2021-12/msg00013.html
>   └────

Sorry, I don't get that?  What do you mean?  AUCTeX can also parse

    \newcommand{\congru}[2][x]{#1\equiv #2\,\modulo}

and offer completion with C-c C-m congru RET, or am I missing something?

Out of curiosity: Can TXS also parse new environments defined with
fancyvrb package?  I mean something like this:

    \documentclass{article}
    \usepackage{fancyvrb}
    \DefineVerbatimEnvironment{MyVerbatim}{Verbatim}{%
      gobble=2,numbers=left,numbersep=2mm,
      frame=lines,framerule=0.8mm}
    \begin{document}
    Try `C-c C-e MyVerbatim RET Optional fancyvrb keyvals RET'?
    \end{document}

Best, Arash




reply via email to

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