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: Denis Bitouzé
Subject: Re: Some LaTeX commands, such as \boldsymbol and \hspace, can't be completed in AUCTeX.
Date: Wed, 08 Dec 2021 14:32:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Le 08/12/21 à 12h39, Arash Esbati a écrit :

> Denis Bitouzé <denis.bitouze@univ-littoral.fr> writes:
>
>> IMO, it's something that should be provided by the editor (or, here, by
>> AUCTeX), not done by the user.
>
> AUCTeX has support for \hspace, just try `C-c C-m hs<TAB> RET' and
> when asked for 'Length: ", press TAB and check the completion.

OK for `\hspace`.

> \linewidth is also available.

Not for `\linewidth`: with `C-c C-m line<TAB>', I only get:

  ┌────
  │ Click on a completion to select it.
  │ In this buffer, type RET to select the completion near point.
  │ 
  │ Possible completions are:
  │ line
  │ linebreak
  │ linethickness
  └────

But see below.

>> And, in this respect, AUCTeX is much less handy than e.g. TeXstudio.
>
> Can you please elaborate what exactly you mean?  I'm not sure if I get
> the point.

I don't remember all the cases where I missed completion but, when I use
TeXstudio (TXS), I often say to myself: completion for this command is
available with TXS and not with AUCTeX, too bad!

>>> Usually they come with the style file associated to a package
>>
>> At least \hspace and \linewidth are core LaTeX macros.
>
> They are there:
>
> http://git.savannah.gnu.org/cgit/auctex.git/tree/latex.el#n7179
> http://git.savannah.gnu.org/cgit/auctex.git/tree/latex.el#n7034
>
> I think the only thing you're missing is that there is no \linewidth
> macro defined in AUCTeX.  AUCTeX records all known lengths in
> `LaTeX-length-list' and use it for completion where needed.  

I would say AUCTeX tries to be too clever here. E.g. with the following:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\linewidth]{example-image}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---

once `graphicx` is taken into account:

1. \includegraphics is available with completion,
2. we are asked for the options (BTW, maybe it would be helpful to
   immediately see the possible options, without having to TAB),
3. if we choose `width=` and start to type:
   1. `\line`, indeed `\linewidth` is available with TAB, but we have to
      type `\` which is not handy on e.g. French keyboards,
   2. `0.7\line` because we want `width=0.7\linewidth`, `\linewidth` is
      not available with TAB.

> Usually, you don't write \linewidth in the middle of a document.

It may happen e.g. if, afterwards, you change your mind and want to
change `\includegraphics[width=15cm]{...}` into
`\includegraphics[width=\linewidth]{...}`.

>> BTW, a TeXstudio contributor is in the way of providing completion files
>> for all the classes/packages! Of course, the format of such (`.cwl`)
>> files is specific to TeXstudio but maybe they could be converted in
>> completion files for AUCTeX.
>
> AUCTeX has also some of them 🙂
>
> http://git.savannah.gnu.org/cgit/auctex.git/tree/style
>
> Any specific package you're missing?

I would say, all! :) What I want to say is that I don't need a specific
one at the moment but anybody can miss any of them at anytime. By
comparison, TXS provides 1387 completion files:

  ┌────
  │ https://github.com/texstudio-org/texstudio/tree/master/completion
  └────

Best.
-- 
Denis



reply via email to

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