Thread: [Vim-latex-devel] Autocompletion of theorems when using tcolorbox
Brought to you by:
srinathava,
tmaas
From: George <geo...@gm...> - 2016-06-20 19:38:18
|
Dear all, 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. Does by any chance vim-latex recognizes labels by grepping the document for "\label{****}" and parsing what's inside? In that case I guess there's no hope but otherwise, Is there any way to work around that? Thank you for your time, George Links: 1. https://www.ctan.org/pkg/tcolorbox?lang=en |
From: Gerd W. <ger...@ma...> - 2016-06-20 20:19:31
|
Dear George, yes, indeed, vim-latex greps through the tex-file for \labels, see ftplugin/latex-suite/outline.py. You could also try to change the logic to cope with tcolorbox's theorems. Or, you try my version of vim-latex at https://github.com/gerw/vim-latex-suite. There, I changed the logic and vim-latex greps through the aux-file instead. This might work for you. (I will also try to backport that feature in the next time) Best regards, Gerd On 2016-06-20 21:38, George wrote: > Dear all, > I'm using tcolorbox <https://www.ctan.org/pkg/tcolorbox?lang=en> 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. > Does by any chance vim-latex recognizes labels by grepping the document for > "\label{****}" and parsing what's inside? In that case I guess there's > no hope > but otherwise, Is there any way to work around that? > Thank you for your time, > George > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity planning > reports. http://sdm.link/zohomanageengine > > > > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel > |
From: George <geo...@gm...> - 2016-06-20 23:06:41
|
Hi Gerd, Many thanks! Before I install your version, is there any small change that I can do to implement this feature in my existing installation? I tried replacing my *ftplugin/latex-suite/outline.py* with yours from github, but this didn't change anything with the issue I described. If there is no simple way of changing the logic as you described, then I'll go on and use your version. > (I will also try to backport that feature in the next time) Do you mean implement this in the official vim-latex? Thanks again, George On Mon, Jun 20, 2016, at 16:19, Gerd Wachsmuth wrote: > Dear George, > > yes, indeed, vim-latex greps through the tex-file for \labels, see > ftplugin/latex-suite/outline.py. You could also try to change > the logic > to cope with tcolorbox's theorems. > > Or, you try my version of vim-latex at > https://github.com/gerw/vim-latex-suite. There, I changed the > logic and > vim-latex greps through the aux-file instead. This might work for you. > (I will also try to backport that feature in the next time) > > Best regards, > Gerd > > > On 2016-06-20 21:38, George wrote: >> Dear all, >> I'm using tcolorbox <https://www.ctan.org/pkg/tcolorbox?lang=en> 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. >> Does by any chance vim-latex recognizes labels by grepping the >> document for >> "\label{****}" and parsing what's inside? In that case I guess >> there's >> no hope >> but otherwise, Is there any way to work around that? >> Thank you for your time, >> George >> >> >> --------------------------------------------------------------------- >> --------- >> What NetFlow Analyzer can do for you? Monitors network bandwidth and >> traffic >> patterns at an interface-level. Reveals which users, apps, and >> protocols are >> consuming the most bandwidth. Provides multi-vendor support for >> NetFlow, >> J-Flow, sFlow and other flows. Make informed decisions using capacity >> planning >> reports. http://sdm.link/zohomanageengine >> >> >> >> _________________________________________________ >> Vim-latex-devel mailing list >> Vim...@li... >> https://lists.sourceforge.net/lists/listinfo/vim-latex-devel >> > |
From: Gerd W. <ger...@ma...> - 2016-06-21 09:23:01
|
Hi George, > Before I install your version, is there any small change that I can do > to implement this feature in my existing installation? I tried replacing > my /ftplugin/latex-suite/outline.py/ with yours from github, but this > didn't change anything with the issue I described. You have to use /ftplugin/latex-suite/auxoutline.py from my repository. Maybe you can replace your outline.py with this auxoutline.py - I am not quite sure if that works. In fact, there is also some logic sitting in texviewer.vim. > (I will also try to backport that feature in the next time) > > Do you mean implement this in the official vim-latex? Yes, I am going to implement this feature in the official version. I am currently not sure, if I should fully replace the old behaviour or if I should enable the user to choose from both methods, see the new discussion at: https://github.com/vim-latex/vim-latex/issues/55 Best regards, Gerd |
From: George <geo...@gm...> - 2016-06-21 10:05:15
|
Hi Gerd, On Tue, Jun 21, 2016, at 05:22, Gerd Wachsmuth wrote: > Hi George, > >> Before I install your version, is there any small change that >> I can do >> to implement this feature in my existing installation? I tried >> replacing >> my /ftplugin/latex-suite/outline.py/ with yours from github, but this >> didn't change anything with the issue I described. > You have to use > > /ftplugin/latex-suite/auxoutline.py > > from my repository. Maybe you can replace your outline.py with this > auxoutline.py - I am not quite sure if that works. In fact, there is > also some logic sitting in texviewer.vim. It's alright then, I'll just use your version. > >> (I will also try to backport that feature in the next time) >> >> Do you mean implement this in the official vim-latex? > Yes, I am going to implement this feature in the official > version. I am > currently not sure, if I should fully replace the old behaviour or if > I > should enable the user to choose from both methods, see the new > discussion at: > > https://github.com/vim-latex/vim-latex/issues/55 Ok, that's great. I'll be following that. Many thanks again, George > > > Best regards, > Gerd |