Menu

Escape % char in user macros

TXS - Help
Tobi
2014-05-10
2014-06-01
  • Tobi

    Tobi - 2014-05-10

    HI,

    I want to create a new user macro that inserts the following code

    %    \begin{macrocode}
    CODE
    %    \end{macrocode}
    %END
    

    Where CODE and END are accessible with ctrl+left/right. This is what I’ve got so far

        \begin{macrocode}
    %<CODE%>
    %    \end{macrocode}
    % %<END%>
    

    But how can I add the % in the first line – if I do it the macro becomes the environment type – and how can I remove the space before END?

    Thanks,
    Tobi

     
  • Benito van der Zander

    You can use %% to escape a %

    But it won't work for the first character.

    You could only put a space before it, or write a script calling some write functins

     
  • Tobi

    Tobi - 2014-05-31

    Hi (sorry for the delays reply), but with a script I can’t write those active %<x%> areas, can I?

     
  • Tim Hoffmann

    Tim Hoffmann - 2014-06-01

    With a normal macro (i.e. just inserting text) you can do:

    \foo{%<x%>}
    

    Within a script you can do the following:

    %SCRIPT
    editorView.insertMacro('\\foo{%<bar%>}')
    
     

Log in to post a comment.