Loading ...
Sorry, an error occurred while loading the content.

Syntax folds for tex

Expand Messages
  • Mary Ellen Foster
    I m trying to set up a syntax folding method for .tex files. I ve got two main types of fold I want to set up: - everything between begin{environment} ...
    Message 1 of 1 , Apr 6, 2001
    • 0 Attachment
      I'm trying to set up a syntax folding method for .tex files. I've got
      two main types of fold I want to set up:
      - everything between \begin{environment} ... \end{environment}
      - everything in a \section, \subsection, or \subsubsection

      I've got the first working with the following:
      syn region myFold start="\\begin{\z([^}]*\)}" end="\\end{\z1}"
      \ transparent fold keepend extend

      However, I can't seem to get the second sort of fold working. What I
      want to have happen is:
      - everything between a \section and the following \section, or the
      \end{document}, should be one fold.
      - everything from a \subsection to a following \subsection, \section, or
      \end{document} in a fold
      - ... etc

      My current attempt at this is the following:
      syn region myFold start=/\\section/ end=/\n\\section\|\n\\end{document}/
      \ transparent fold
      syn region myFold start=/\\subsection/
      \ end=/\n\\subsection\|\n\\section\|\n\\end{document}/
      \ transparent fold

      However, this doesn't work; when used with the full tex.vim, it puts
      everything after the first \section into a fold, then everything from
      the second \section to the end into a sub-fold, and so on until the
      whole document is in nested folds.

      Is there anyone more versed than I am in the mysteries of folds who can
      suggest where this is going wrong, and maybe a way that I can create
      folds of the type I'd like?

      Thanks,

      MEF

      --
      Mary Ellen Foster / ICCS / Informatics / University of Edinburgh
      M.E.Foster@... http://www.iccs.informatics.ed.ac.uk/~mef/
      -------------------- Law of Software Envelopment: --------------------
      Every program attempts to expand until it can read mail.
    Your message has been successfully submitted and would be delivered to recipients shortly.