On Mon, 7 May 2001 17:34:30 +0300 wrote Dekel Tsur <[EMAIL PROTECTED]>:

> On Mon, May 07, 2001 at 10:46:35AM +0200, Guenter Milde wrote:
> > This could be automated with a math-macro. I tried and defined a makro \cases
> > 
> > However, it did not work correct

> Your problem is that you shouldn't enter #1 in the macro definition.
> Instead, you should write 'math-macro-arg 1' in the minibuffer.
> Also, \cases is a command in latex. Use a different name.

Thanks to Dekels fast help, here is the macro \mycases that offers a quick
solution without additional package and with wysiwym support.

there remains the problem with navigation in the array. Left moves you out of
the array even if you're in the first of two boxes. Down will travel along all
the boxes. (Looks like the navigation-implementation of math-macro was built for
\frac-like constructs.)

--
[EMAIL PROTECTED]
#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 218
\textclass article
\begin_preamble
% Real- und Imaginärteil mit lateinischen Buchstaben
\renewcommand{\Im}{\mathrm{Im}}
\renewcommand{\Re}{\mathrm{Re}}
% Vektoren als schräge fette Buchstaben
\renewcommand{\vec}[1]{\textbf{\itshape #1}}
\end_preamble
\language german
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize a4paper
\paperpackage a4
\use_geometry 1
\use_amsmath 0
\paperorientation portrait
\leftmargin 2cm
\topmargin 1cm
\rightmargin 2cm
\bottommargin 1cm
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip medskip
\quotes_language german
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle plain

\layout Standard


\begin_inset FormulaMacro 
\newcommand{\mycases}[4]{\left\{ \begin{array}{ll}
#1  & #2 \\
#3  & #4 
\end{array}\right. }

\end_inset 


\layout Comment

The macro mycases was created with
\layout Comment

M-x math-macro cases 4
\layout Comment

To use it, write mycases in math-mode and you will get 
\layout Comment


\begin_inset Formula \( \mycases{}{}{}{} \)
\end_inset 

 which can be filled like 
\begin_inset Formula \( x=\mycases{y}{\, \textrm{ if }x>0\textrm{ }}{y+z}{\, \textrm{ if }x<0} \)
\end_inset 


\layout Comment

However, there are problems with navigation in the boxes of the array, therefore
 you might be better of constructing the thing anew everytime you need it
 or copy a template.
\the_end

Reply via email to