1 #This file was created by <ale> Wed Oct 29 15:21:35 1997
2 #LyX 0.11 (C) 1995-1997 Matthias Ettrich and the LyX Team
14 \paperorientation portrait
17 \paragraph_separation indent
19 \quotes_language english
23 \paperpagestyle default
27 User defined macros in math mode
30 Alejandro Aguilar Sierra
39 LyX version 0.12 allows the user to define macros.
40 An user defined macro in math mode is not a red colored name that LyX didn't
41 know how to draw (formerly known as macro mode, now simply TeX mode).
42 A macro definition box appears on screen as a grayed button with the name
43 of the macro in blue (math color).
44 But if you click on it, it will appear as a normal math box to allow you
47 \begin_inset FormulaMacro
48 \newcommand{\macro}{a+b}
55 Now, to use this macro in other math boxes just type the name in TeX mode,
62 , and it will be automatically expanded:
63 \begin_inset Formula \( c=\macro \)
67 As you can verify, the cursor can't go inside the macro, the whole macro
68 is like a single character, and the TeX generated code of this expression
76 However the cursor could go inside of some kind of macros, those that have
82 In a macro definition box an argument looks like a
86 followed by the argument number:
87 \begin_inset FormulaMacro
88 \newcommand{\macrowarg}[1]{2+\sqrt{#1 }}
95 Once expanded, this macro includes the usual empty rectangle to indicate
96 that you can insert there whatever you want:
101 \begin_inset Formula \( \macrowarg{} \)
108 \begin_inset Formula \( b=\macrowarg{x-2} \)
115 When exported to LaTeX, a macro definition will produce the command
122 Directions on using macros
128 To create a macro definition box use this syntax in the minibuffer:
133 math-macro <macro name> [number of arguments]
143 \begin_inset Quotes eld
151 \begin_inset Quotes erd
161 \begin_inset Quotes eld
166 math-macro macrowarg 1
169 \begin_inset Quotes erd
175 To insert an argument mark (only inside a macro definition box) use this:
180 math-macro-arg <number>
190 \begin_inset Quotes eld
198 \begin_inset Quotes erd
204 You can use no more than 9 arguments, numbered from 1 to 9.
205 An argument can be repeated inside the macro definition box, but of course
206 can be edited only once.
207 A number can't be greater than the number of arguments originally allowed
221 keys: Opening a macro form the left side will put the cursor in the first
222 argument, to move to the second argument use the TAB key.
223 Remember that pressing the Space bar will get the cursor out and at the
224 right side of the macro.
231 mouse: As usual, click on the desired argument box.
232 Sometimes this fails if the box is empty or too small.
235 Currently the user can only define command macros, but internally it's possible
236 to define also environment macros.
239 There are several predefined macros, mainly to allow AMS-LaTeX users to
240 use AMS macros in a WYSIWYM way, like
261 are currently disabled because after some simplification and improving
262 of the macro stuff, the only valid arguments are subparagraphs (neither
264 Perhaps they will be again included before 0.12