# How to creat a macro from a code Maple to TeX?

I copy a code from Maple and past it into LaTeX. For example, the equation of the line in geometry 3D is

\begin{equation*}
\begin{cases}
x =-1 + 5t,\\
y = 3+t,\\
z =-3 + t
\end{cases}
\end{equation*}


The code in Maple is [-1+5*t, 3+t, -3+t].
I want to make a macro. How do I do that? I tried

\newcommand{\droit}[3]{\displaystyle\Delta: \begin{cases}
{#1},\\
{#2},\\
{#3}.
\end{cases}}

\begin{equation*}
\droit{x =t + 1}{y = 2t - 2}{3t + 1}
\end{equation*}

-
You tried? But what happened? And what did you expect? What should your new command do? What has that to do with Maple? Do you want a macro that works like \droit[x=t+1,y=2t-2,z=3t+1]? –  Qrrbrbirlbel Nov 28 '12 at 2:30

Hopefully, this goes in the right direction …

## Code

\documentclass{article}
\usepackage{amsmath}
\usepackage{xstring}
\newcommand{\substituteMe}[2]{\StrSubstitute{#1}{*}{#2}}
\def\droit[#1,#2,#3]{\Delta:\begin{cases}#1,\\#2,\\#3.\end{cases}}
\def\Droit[#1,#2,#3]{\Delta:\begin{cases}x=#1,\\y=#2,\\z=#3.\end{cases}}
\def\DRoit#1[#2,#3,#4]{\Delta:\begin{cases}x=\substituteMe{#2}{#1},\\y=\substituteMe{#3}{#1},\\z=\substituteMe{#4}{#1}.\end{cases}}
\begin{document}
\begin{equation*}
\droit[x=t+1,y=2t-2,z=3t+1]
\end{equation*}
\begin{equation*}
\Droit[t+1,2t-2,3t+1]
\end{equation*}
\begin{equation*}
\DRoit[t+1,2*t-2,3*t+1]
\end{equation*}
\begin{equation*}
\DRoit\cdot[t+1,2*t-2,3*t+1]
\end{equation*}
\end{document}


## Output

-
I see a situation is the name of the line is not alway $\Delta$. Please help me at the command '\def\DRoit#1[#2,#3,#4]{\Delta:\begin{cases}x=\substituteMe{#2}{#1},\\y=\substitu‌​teMe{#3}{#1},\\z=\substituteMe{#4}{#1}.\end{cases}}'. –  minthao_2011 Nov 28 '12 at 6:33
@minthao_2011 You can remove \Delta: from the macro's definition or do you want to have \DRoit having a fifth argument that is then typeset in front of :\begin{cases}? –  Qrrbrbirlbel Nov 29 '12 at 11:11
Yes. I did so. Thank you very much. –  minthao_2011 Nov 29 '12 at 16:44