Re: [Vim-latex-devel] Aux completion
Hi, > - F9 works only after the first compilation (not too restrictive) > - F9 completes based on either labels or current reference numbers. - > The labels method works almost as before, except that the outline window > does not show a preview of the relevant part of the .tex file. Yes. > For the "new" method, how does your algorithm detect which numbers to > scan? It looks in the aux-file and tries to differentiate between equations (which use \eqref) and other things (which use \cref, \autoref, or simply \ref). It works best if you are using hyperref and cleveref. E.g. by using the tex-file = \documentclass[]{article} \usepackage{hyperref} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \begin{document} \section{Preliminaries} \begin{theorem} \label{lem:trivial} \begin{equation} \label{sec:trivial} 1 + 1 = 2 \end{equation} \end{theorem} \begin{lemma} \label{lem:obvious} \begin{equation} \label{subsec:obvios} 2 = 1 + 1 \end{equation} \end{lemma} \end{document} = you can use the following four completions: theorem.1.1 => \cref{lem:trivial} lemma.1.2 => \cref{lem:obvious} (1) => \eqref{sec:trivial} (2) => \eqref{subsec:obvious} Moreover, you can still complete via the labels, e.g. "\ref{". > Is it sensitive to a keyword like section, part, theorem, eq, fig, > etc. when F9 is hit? No, it just looks into the aux file. It does not matter that e.g. the label is prefixed with something like "eq:" (see above). This renders this method really robust. > And depending on this keyword, it enters various > commands like \autoref, \eqref... right? Currently, it uses Tex_RefCompletionCommand for the completion of something like "theorem.1.", \eqref for the completion of something that looks like an equation number, e.g. "(1". You can also use "\myrefcommand{" to get a completion with a custom reference command (which should contain 'ref'). > How about the \cite command? As far as I understand, its > functionality would stay as before. Yes, this has not been changed. Anybody who would try to test the new behaviour, is invited to use https://github.com/gerw/vim-latex-suite instead of the default latex-suite. Best regards, Gerd -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel
Re: [Vim-latex-devel] Aux completion
Hello, things start to be clearer to me and it seems to me that the new version could, indeed, supersede the old one in functionality. To summarize, in the new version: - F9 works only after the first compilation (not too restrictive) - F9 completes based on either labels or current reference numbers. - The labels method works almost as before, except that the outline window does not show a preview of the relevant part of the .tex file. For the "new" method, how does your algorithm detect which numbers to scan? Is it sensitive to a keyword like section, part, theorem, eq, fig, etc. when F9 is hit? And depending on this keyword, it enters various commands like \autoref, \eqref... right? But in plain LaTeX, just \ref{} should suffice, maybe with options \ref{sec:}, \ref{fig:}, \ref{eq:} etc., I think. How about the \cite command? As far as I understand, its functionality would stay as before. Filip On Fri, 27 Jan 2017, Gerd Wachsmuth wrote: Date: Fri, 27 Jan 2017 19:42:28 From: Gerd Wachsmuth To: Filip Kadlec , "vim-latex-devel@lists.sourceforge.net" Subject: Re: [Vim-latex-devel] Aux completion Thank you for your comments. I think I was not precise at one point: You still can use labels for completion (as long as they are already in the aux file). To given an example: \documentclass{article} \usepackage{hyperref} \begin{document} \begin{equation} \label{eq:einstein} E = m \, c^2 \end{equation} \begin{equation} a^2 + b^2 = c^2 \label{eq:pythagoras} \end{equation} \end{document} The current version produces the following outline window: eq:einstein : eq:pythagoras :a^2 + b^2 = c^2 You can only use the labels for completion and you see some of the surrounding text. The new, aux-based version produces: eq:einstein : (1) eq:pythagoras : (2) Here, you can use both, the label and the actual number, with the new aux completion. However, you do not see some of the text. Moreover, the old mechanism fails to detect if you input some other files via macros, e.g., \newcommand{\myinput}[1]{\input{#1}} and then \myinput{test}. Since the labels of the file test.tex still appear in the aux file, the aux based completion also find those labels. In my opinion, the only regress is that you have to compile (once) after entering a new \label{} and before you will be able to complete a reference to exactly this label. Best regards, Gerd On 2017-01-27 10:05, Filip Kadlec wrote: Hi, Gerd, I second Laszlo's point of view; for me, using labels with well chosen names is clearly the best choice, and I think that the latex-suite should keep this behavior by default. To me, the -completion works quite well and it would maybe need some improvements (it does not work for me with \includegraphics, and if the vim-window is split when invoking in \cite, it oftentimes fails...) but not a complete change of logic. Your idea to scan the .aux files could be useful for someone, though. I don't know if it is feasible, but I would suggest an implementation via a command, something like let g:Tex_completion_scanfile = tex / aux whereby everyone would have the choice. This would does not imply less code nor less maintenance, though. Best regards, Filip On Thu, 26 Jan 2017, N Laszlo Frazer wrote: Date: Thu, 26 Jan 2017 21:33:44 From: N Laszlo Frazer To: "vim-latex-devel@lists.sourceforge.net" Subject: Re: [Vim-latex-devel] Aux completion Please do not remove the current functionality. I think it would be very annoying to rely on the aux file being up-to-date. Well-chosen keys are much easier to remember than numbers, and they do not change when you expand the document. On Fri, 27 Jan 2017 00:52:25 +1100, Gerd Wachsmuth wrote: Hi, in my version of latex-suite (https://github.com/gerw/vim-latex-suite), I have changed the mechanism of \ref-completions. The current version of latex-suite greps through the tex-file for \labels. My version greps through the aux-file. This has the advantage, that one does not have to memorize the keys within the \labels for completion, but can use the actual labels in the compiled document. Hence, you get the following expansions (given that the tex-file has the corresponding labels): theorem.1.3 => \autoref{thm:bar} section.2 => \autoref{sec:foo} (1.9 => \eqref{eq:baz} (1.9) => \eqref{eq:baz} (You can also reconfigure an option to use \cref (or anything else) instead of \autoref) This is quite convenient, because you can look in the pdf to get the appropriate number of the thing you want to refer to and use this for the compl
Re: [Vim-latex-devel] Aux completion
Hi all, I switched to Gerd's version of vim-latex while I'm writing my thesis. The reason is that I'm using tcolorbox[1] to create coloured boxes for my theorems. Tcolorbox has its own way of labelling theorems, which does not play well with the label completion of vim-latex suite. Here is an example to demonstrate. First I define a theorem environment using tcolorbox, as follows: \newtcbtheorem[number within=section]% {theorem} % \begin.. {Theorem} % Title {} % Style - default {theo} % label prefix; cite as ``theo:yourlabel'' Then, inside my document I can write: \begin{theorem}{The title}{mylabel} This is a theorem. \end{theorem} and I'll get a theorem inside a coloured box. Then I can cite that theorem by writing "\ref{theo:mylabel}". The problem is that if I type "\ref{" and press F9, vim-latex will not recognise the label "theo:mylable", so it won't automplete. Gerd's approach fixes this. That said, I understand that this is a rather special case, but I just thought of throwing it in the discussion. Cheers, George On Fri, Jan 27, 2017, at 20:42, Gerd Wachsmuth wrote: > Thank you for your comments. > > I think I was not precise at one point: You still can use labels for > completion (as long as they are already in the aux file). > > To given an example: > > \documentclass{article} > \usepackage{hyperref} > \begin{document} > \begin{equation} > \label{eq:einstein} > E = m \, c^2 > \end{equation} > \begin{equation} > a^2 + b^2 = c^2 > \label{eq:pythagoras} > \end{equation} > \end{document} > > > The current version produces the following outline window: > > > eq:einstein > : > > eq:pythagoras > :a^2 + b^2 = c^2 > > You can only use the labels for completion and you see some of the > surrounding text. > > The new, aux-based version produces: > > >eq:einstein > : (1) > >eq:pythagoras > : (2) > > Here, you can use both, the label and the actual number, with the new > aux completion. However, you do not see some of the text. > > > Moreover, the old mechanism fails to detect if you input some other > files via macros, e.g., > \newcommand{\myinput}[1]{\input{#1}} > and then > \myinput{test}. > Since the labels of the file test.tex still appear in the aux > file, the > aux based completion also find those labels. > > > In my opinion, the only regress is that you have to compile > (once) after > entering a new \label{} and before you will be able to complete a > reference to exactly this label. > > > Best regards, > Gerd > > > On 2017-01-27 10:05, Filip Kadlec wrote: >> Hi, Gerd, >> >> I second Laszlo's point of view; for me, using labels with >> well chosen >> names is clearly the best choice, and I think that the latex- >> suite should >> keep this behavior by default. To me, the -completion works >> quite well >> and it would maybe need some improvements (it does not work for >> me with >> \includegraphics, and if the vim-window is split when invoking >> in >> \cite, it oftentimes fails...) but not a complete change of logic. >> >> Your idea to scan the .aux files could be useful for someone, >> though. I >> don't know if it is feasible, but I would suggest an >> implementation via a >> command, something like >> >> let g:Tex_completion_scanfile = tex / aux >> >> whereby everyone would have the choice. >> >> This would does not imply less code nor less maintenance, though. >> >> Best regards, >> Filip >> >> On Thu, 26 Jan 2017, N Laszlo Frazer wrote: >> >>> Date: Thu, 26 Jan 2017 21:33:44 >>> From: N Laszlo Frazer >>> To: "vim-latex-devel@lists.sourceforge.net" >>> >>> Subject: Re: [Vim-latex-devel] Aux completion >>> >>> Please do not remove the current functionality. I think it would >>> be very >>> annoying to rely on the aux file being up-to-date. >>> >>> Well-chosen keys are much easier to remember than numbers, and >>> they do >>> not >>> change when you expand the document. >>> >>> On Fri, 27 Jan 2017 00:52:25 +1100, Gerd Wachsmuth >&g
Re: [Vim-latex-devel] Aux completion
Thank you for your comments. I think I was not precise at one point: You still can use labels for completion (as long as they are already in the aux file). To given an example: \documentclass{article} \usepackage{hyperref} \begin{document} \begin{equation} \label{eq:einstein} E = m \, c^2 \end{equation} \begin{equation} a^2 + b^2 = c^2 \label{eq:pythagoras} \end{equation} \end{document} The current version produces the following outline window: > eq:einstein : > eq:pythagoras :a^2 + b^2 = c^2 You can only use the labels for completion and you see some of the surrounding text. The new, aux-based version produces: >eq:einstein : (1) >eq:pythagoras : (2) Here, you can use both, the label and the actual number, with the new aux completion. However, you do not see some of the text. Moreover, the old mechanism fails to detect if you input some other files via macros, e.g., \newcommand{\myinput}[1]{\input{#1}} and then \myinput{test}. Since the labels of the file test.tex still appear in the aux file, the aux based completion also find those labels. In my opinion, the only regress is that you have to compile (once) after entering a new \label{} and before you will be able to complete a reference to exactly this label. Best regards, Gerd On 2017-01-27 10:05, Filip Kadlec wrote: > Hi, Gerd, > > I second Laszlo's point of view; for me, using labels with well chosen > names is clearly the best choice, and I think that the latex-suite should > keep this behavior by default. To me, the -completion works quite well > and it would maybe need some improvements (it does not work for me with > \includegraphics, and if the vim-window is split when invoking in > \cite, it oftentimes fails...) but not a complete change of logic. > > Your idea to scan the .aux files could be useful for someone, though. I > don't know if it is feasible, but I would suggest an implementation via a > command, something like > > let g:Tex_completion_scanfile = tex / aux > > whereby everyone would have the choice. > > This would does not imply less code nor less maintenance, though. > > Best regards, > Filip > > On Thu, 26 Jan 2017, N Laszlo Frazer wrote: > >> Date: Thu, 26 Jan 2017 21:33:44 >> From: N Laszlo Frazer >> To: "vim-latex-devel@lists.sourceforge.net" >> >> Subject: Re: [Vim-latex-devel] Aux completion >> >> Please do not remove the current functionality. I think it would be very >> annoying to rely on the aux file being up-to-date. >> >> Well-chosen keys are much easier to remember than numbers, and they do >> not >> change when you expand the document. >> >> On Fri, 27 Jan 2017 00:52:25 +1100, Gerd Wachsmuth >> wrote: >> >>> Hi, >>> >>> in my version of latex-suite (https://github.com/gerw/vim-latex-suite), >>> I have changed the mechanism of \ref-completions. The current version of >>> latex-suite greps through the tex-file for \labels. My version greps >>> through the aux-file. This has the advantage, that one does not have to >>> memorize the keys within the \labels for completion, but can use the >>> actual labels in the compiled document. >>> >>> Hence, you get the following expansions (given that the tex-file has the >>> corresponding labels): >>> >>> theorem.1.3 => \autoref{thm:bar} >>> section.2 => \autoref{sec:foo} >>> (1.9 => \eqref{eq:baz} >>> (1.9) => \eqref{eq:baz} >>> >>> (You can also reconfigure an option to use \cref (or anything else) >>> instead of \autoref) >>> >>> This is quite convenient, because you can look in the pdf to get the >>> appropriate number of the thing you want to refer to and use this for >>> the completion. No need for packages like showkeys. >>> >>> The only disadvantage is that you get the labels from the aux-file. >>> Hence, if the aux-file is not up-to-date or you use the numbers from a >>> print-out (and the aux-file is more recent), you might get unexpected >>> results. >>> >>> My question is: Can I replace the current style of the completion with >>> this aux-based completion in the official repository? This would result >>> in less code (less maintenance) and is therefore desirable. However, I
Re: [Vim-latex-devel] Aux completion
Hi, Gerd, I second Laszlo's point of view; for me, using labels with well chosen names is clearly the best choice, and I think that the latex-suite should keep this behavior by default. To me, the -completion works quite well and it would maybe need some improvements (it does not work for me with \includegraphics, and if the vim-window is split when invoking in \cite, it oftentimes fails...) but not a complete change of logic. Your idea to scan the .aux files could be useful for someone, though. I don't know if it is feasible, but I would suggest an implementation via a command, something like let g:Tex_completion_scanfile = tex / aux whereby everyone would have the choice. This would does not imply less code nor less maintenance, though. Best regards, Filip On Thu, 26 Jan 2017, N Laszlo Frazer wrote: Date: Thu, 26 Jan 2017 21:33:44 From: N Laszlo Frazer To: "vim-latex-devel@lists.sourceforge.net" Subject: Re: [Vim-latex-devel] Aux completion Please do not remove the current functionality. I think it would be very annoying to rely on the aux file being up-to-date. Well-chosen keys are much easier to remember than numbers, and they do not change when you expand the document. On Fri, 27 Jan 2017 00:52:25 +1100, Gerd Wachsmuth wrote: Hi, in my version of latex-suite (https://github.com/gerw/vim-latex-suite), I have changed the mechanism of \ref-completions. The current version of latex-suite greps through the tex-file for \labels. My version greps through the aux-file. This has the advantage, that one does not have to memorize the keys within the \labels for completion, but can use the actual labels in the compiled document. Hence, you get the following expansions (given that the tex-file has the corresponding labels): theorem.1.3 => \autoref{thm:bar} section.2 => \autoref{sec:foo} (1.9 => \eqref{eq:baz} (1.9) => \eqref{eq:baz} (You can also reconfigure an option to use \cref (or anything else) instead of \autoref) This is quite convenient, because you can look in the pdf to get the appropriate number of the thing you want to refer to and use this for the completion. No need for packages like showkeys. The only disadvantage is that you get the labels from the aux-file. Hence, if the aux-file is not up-to-date or you use the numbers from a print-out (and the aux-file is more recent), you might get unexpected results. My question is: Can I replace the current style of the completion with this aux-based completion in the official repository? This would result in less code (less maintenance) and is therefore desirable. However, I can understand if someone would like to stay with the current behavior. The stage is open for discussion, see also https://github.com/vim-latex/vim-latex/issues/55 Best regards, Gerd -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel Upozornění / Disclaimer <http://www.fzu.cz/e-mail-upozorneni-disclaimer>-- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel
Re: [Vim-latex-devel] Aux completion
Please do not remove the current functionality. I think it would be very annoying to rely on the aux file being up-to-date. Well-chosen keys are much easier to remember than numbers, and they do not change when you expand the document. On Fri, 27 Jan 2017 00:52:25 +1100, Gerd Wachsmuth wrote: > Hi, > > in my version of latex-suite (https://github.com/gerw/vim-latex-suite), > I have changed the mechanism of \ref-completions. The current version of > latex-suite greps through the tex-file for \labels. My version greps > through the aux-file. This has the advantage, that one does not have to > memorize the keys within the \labels for completion, but can use the > actual labels in the compiled document. > > Hence, you get the following expansions (given that the tex-file has the > corresponding labels): > > theorem.1.3 => \autoref{thm:bar} > section.2 => \autoref{sec:foo} > (1.9 => \eqref{eq:baz} > (1.9) => \eqref{eq:baz} > > (You can also reconfigure an option to use \cref (or anything else) > instead of \autoref) > > This is quite convenient, because you can look in the pdf to get the > appropriate number of the thing you want to refer to and use this for > the completion. No need for packages like showkeys. > > The only disadvantage is that you get the labels from the aux-file. > Hence, if the aux-file is not up-to-date or you use the numbers from a > print-out (and the aux-file is more recent), you might get unexpected > results. > > My question is: Can I replace the current style of the completion with > this aux-based completion in the official repository? This would result > in less code (less maintenance) and is therefore desirable. However, I > can understand if someone would like to stay with the current behavior. > > The stage is open for discussion, see also > https://github.com/vim-latex/vim-latex/issues/55 > > > Best regards, > Gerd > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Vim-latex-devel mailing list > Vim-latex-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Vim-latex-devel mailing list Vim-latex-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vim-latex-devel