Cursor location for macros

TXS - Help
2013-02-21
2013-02-21
  • Oscar Levin

    Oscar Levin - 2013-02-21

    Hello,

    First let thank you for a great program - easily the best LaTeX editor I have found.

    I am trying to write a macro to insert an environment I use often when working with the exam documentclass. What I would like is to be able to type "\begin{questions}" and have it replaced by:

    \begin{questions}
            \question
    \end{questions}
    

    with the cursor placed right after the "\question" on the second line. I can add \begin{questions} to a custom cwl file, but this does not allow for the custom text inside the environment (and produces the annoying red placeholder box).

    In fact, I would like to be able to do this for the itemize and enumerate environments as well (as is done in Kile).

    Thanks,
    Oscar.

     
  • Benito van der Zander

    You can use %| to mark the cursor posiiton in the cwl file or macros.
    Two %| .. %| can be used to select a piece of text.

    And %n can be used to insert a line break (e.g. something like
    \begin{questions}%n \question%|\end{questions} should work in the cwl)

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks