Thread: [Vim-latex-devel] Custom verbatim-like environment
Brought to you by:
srinathava,
tmaas
From: rocku <ro...@gm...> - 2009-08-21 18:53:08
|
Hi, I defined a custom 'code' environment using fancyvrb package. I would like this environment to be treated by latex-suite just like the verbatim environment, that is -- turn off all special characters effect inside it. Currently when I put code inside, then for example the '$' character breaks latex-suite outside of my 'code' environment. Is there a way to fix this? -- rocku |
From: Ted P. <te...@te...> - 2009-08-21 20:34:58
|
Without giving it much thought, try something like... \begin{verbatim} \endverbatim \begin{code} ... \end{code} \verbatim \end{verbatim} That is, recall that... \begin{verbatim} is LaTeX's way of saying \verbatim and... \end{verbatim} is LaTeX's way of saying \endverbatim except the \begin and \end macros add some extra protection. Vim-LaTeX only looks for the \begin and \end varieties, and so it shouldn't "see" the \endverbatim and the \verbatim, but LaTeX will. --Ted On 8/21/09 2:52 PM, rocku wrote: > > Hi, > I defined a custom 'code' environment using fancyvrb package. I would > like this environment to be treated by latex-suite just like the > verbatim environment, that is -- turn off all special characters effect > inside it. Currently when I put code inside, then for example the '$' > character breaks latex-suite outside of my 'code' environment. Is there > a way to fix this? > > -- > rocku > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel > -- Ted Pavlic <te...@te...> Please visit my 2009 d'Feet ALS walk page: http://web.alsa.org/goto/tedp My family appreciates your support in the fight to defeat ALS. |
From: rocku <ro...@gm...> - 2009-08-21 21:06:49
|
Ted Pavlic pisze: > Without giving it much thought, try something like... > > \begin{verbatim} > \endverbatim > \begin{code} > ... > \end{code} > \verbatim > \end{verbatim} This does not work, I receive the following after \ll in vim (using texlive): || pdfTeX warning (ext4): destinati |669 error| Extra \endgroup. |669 error| \begin{document} ended by \end{code}. |669 error| Extra \endgroup. |671 error| \begin{document} ended by \end{verbatim}. |671 error| Extra \endgroup. || Emergency stop. || ==> Fatal error occurred, no output PDF file produced! I don't want to use the listings package as it would be just overkill to what I am trying to do. I thought more of a workaround, possibly some patch to latex-suite to force verbatim-like behavior to my 'code' environment. I scanned throught the sources, but couldn't figure out how latex-suite ignores verbatim environment. I am not familiar with vim's script language, though. -- rocku |
From: Aditya M. <ad...@um...> - 2009-08-21 21:18:46
|
On Fri, 21 Aug 2009, rocku wrote: > Ted Pavlic pisze: >> Without giving it much thought, try something like... >> >> \begin{verbatim} >> \endverbatim >> \begin{code} >> ... >> \end{code} >> \verbatim >> \end{verbatim} > > This does not work, I receive the following after \ll in vim (using > texlive): > > || pdfTeX warning (ext4): destinati > |669 error| Extra \endgroup. > > > |669 error| \begin{document} ended by \end{code}. > |669 error| Extra \endgroup. > |671 error| \begin{document} ended by \end{verbatim}. > |671 error| Extra \endgroup. > || Emergency stop. > || ==> Fatal error occurred, no output PDF file produced! > > > I don't want to use the listings package as it would be just overkill to > what I am trying to do. I thought more of a workaround, possibly some > patch to latex-suite to force verbatim-like behavior to my 'code' > environment. I scanned throught the sources, but couldn't figure out how > latex-suite ignores verbatim environment. I am not familiar with vim's > script language, though. You can you %stopzone to avoid the syntax highlighting from overrunning. For example \begin{code} $whatever \end{code}%stopzone should work. The syntax highlighting inside the code is still wrong, but at least it will not overflow. Another option is to open $VIMRUNTIME/syntax/tex.vim and search for verbatim. You will see a sequence of lines like. syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" contains=@Spell Add another similar line replacing verbatim with code. That will make the code environment behave like the verbatim environment. Aditya |
From: rocku <ro...@gm...> - 2009-08-22 13:59:50
|
Aditya Mahajan pisze: >> I don't want to use the listings package as it would be just overkill to >> what I am trying to do. I thought more of a workaround, possibly some >> patch to latex-suite to force verbatim-like behavior to my 'code' >> environment. I scanned throught the sources, but couldn't figure out how >> latex-suite ignores verbatim environment. I am not familiar with vim's >> script language, though. > > You can you %stopzone to avoid the syntax highlighting from overrunning. > For example > > \begin{code} > $whatever > \end{code}%stopzone Thanks, that solved it. Altought I have to put %stopzone on the next line because otherwise fancyvrb prints a error: error| FancyVerb Error: Extraneous input ` %stopzone\end{}' between \end{code} and line end > should work. The syntax highlighting inside the code is still wrong, but > at least it will not overflow. > > Another option is to open $VIMRUNTIME/syntax/tex.vim and search for > verbatim. You will see a sequence of lines like. > > syn region texZone start="\\begin{verbatim}" > end="\\end{verbatim}\|%stopzone\>" contains=@Spell > > Add another similar line replacing verbatim with code. That will make > the code environment behave like the verbatim environment. I also tried this and it works! I'll stick to this solution. Thanks! -- rocku |
From: Ted P. <te...@te...> - 2009-08-21 20:39:54
|
Also, check out the "listings" package, which provides some alternate ways to do what you're doing. --Ted On 8/21/09 2:52 PM, rocku wrote: > > Hi, > I defined a custom 'code' environment using fancyvrb package. I would > like this environment to be treated by latex-suite just like the > verbatim environment, that is -- turn off all special characters effect > inside it. Currently when I put code inside, then for example the '$' > character breaks latex-suite outside of my 'code' environment. Is there > a way to fix this? > > -- > rocku > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel > -- Ted Pavlic <te...@te...> Please visit my 2009 d'Feet ALS walk page: http://web.alsa.org/goto/tedp My family appreciates your support in the fight to defeat ALS. |