# naming argument and optional-argument for \def, \newcommand and newenvironment

I know how to create a new command or an environment. I think it will much better if I can specify name of the arguments. For example in framebox command and array environment below, we know exactly what're the arguments that should be passed.

\framebox(xdimen,ydimen)[position]{text}

\begin{array}[pos]{cols}
content...
\end{array}


So far, I've tried

\documentclass{article}

\def\testdef#1#2{#1 #2}

\newcommand{\testcommand}[2]{#1 #2}

\newenvironment{testenv}[2]{#1}{#2}

\begin{document}

\testdef{arg1}{arg2}

\testcommand

\begin{testenv}{1}{2}
content...
\end{testenv}

\end{document}


and you all can see, \testdef{arg1}{arg2} just print arg1 and arg2 while I need to naming them with, for example, name and value. It should be

\testdef{name}{value}


The same goes also for \testcommand and testenv. So, How can I do that?

### Edit

These pictures is taken from TeXstudio.

In picture #1, we see what are arguments for \framebox.

while in picture #2, we just see \testdef{arg1}{arg2}.

Is it behavior of Latex editor? or we can tune it through latex macro?

-
Your question isn't very clear but I think you are looking for a syntax like \testdef{arg1=value1, arg2=value2} in which case you should look at the keyval package (or extended versions such as xkeyval or l3keys) –  David Carlisle May 7 '14 at 8:18
In the documentation, something like \begin{array}[<pos>]{<cols>} uses <pos> and <cols> as place-holders to show what is going on, but in the code you still need #1, #2, etc. In TeX parameters have numbers, not names (you can work-around this in LuaTeX, but that I know of this has only been done in ConTeXt and not in LaTeX). –  Joseph Wright May 7 '14 at 8:21
Your edited question is just about the help prompts added by that editor, it is nothing to do with TeX at all, sorry I can't help as I don't use that editor. –  David Carlisle May 7 '14 at 10:27
TeXstudio stores the auto-completion data as a series of .cwl files: see e.g. tex.stackexchange.com/questions/79643/… for some discussion of altering/adding them. The thing is that this requires knowing what commands to add: are you looking to extend by a 'fixed' set of commands? –  Joseph Wright May 7 '14 at 10:38