# newcommand problem

I am trying to create a new command that represent one word larger than the text.

``````\newcommand {\Large}{\Large} is that right?
``````

And then I have to integrate the top command in this

``````\newcommand{\smindexx}[2]{#2 \index{#2}}
``````

I use `smindexx` as follow `\smindexx{\ITerm}{Test}` and Test should be larger than the other words.

How can I do that, have someone an idea?

-
`\renewcommand {\Large}{\Large} ` defines `\Large` to be a non-terminating infinite loop \Large expands to \Large which expands to ... But it isn't clear what your intended behaviour is. –  David Carlisle Oct 2 '13 at 11:08
I have to write a command like \newcommand{\smindexx}[2]{#2 \index{#2}}, but the word should be in text larger, but not in the index. When the word is larger than the text the co author can see there is a problem with this word. When he correct this word, this command should be turn off. I hope its now clear.... –  blue Oct 2 '13 at 11:56
Your question is very unclear. `\newcommand{\smindexx}[2]{#2 \index{#2}}` defines `\smindexx` to take two arguments but it discards `#1` and uses `#2` twice. You show usage as `\smindexx{\ITerm}{Test}` without saying what `\Iterm` is. As defined it would be discarded but assuming the definition of `\smindexx` is changed you presumably want one argument to appear as large text at this point, and the other to go into the index? –  David Carlisle Oct 2 '13 at 12:19
\Iterm is not important, because i don't use it in this moment. Therefore is this like \newcommand{\smindexx}[2]{#2 \index{#2}}, because I dont use the first argument, but the second. \smindexx{\ITerm}{Test} Test is here the word in the text and it is the second argument, therefore he goes to the index.. But I want that the word Test in text appears larger.. –  blue Oct 2 '13 at 12:29

There are some issues with your approach:

Firstly, `\newcommand` takes the number of arguments in brackets `[2]` and then refers to the arguments as `#1` and `#2`. So your second code segment should be

``````\newcommand{\smindexx}[2]{#1 \index{#2}}
``````

And would be called by

``````\smindexx{\ITerm}{Test}
``````

so that part you got right.


If you simply want test to be `\Large` you can simply nest commands:

``````\newcommand{\smindexx}[2]%
{%
#2%
\index{%
\Large{#2}%
}%
}
``````

The indentation is superfluous, but I hope it clarifies the idea. The part where you renewcommand `\Large` is unnecessary.

-
There is no compiler dependency. defining \Large to be \Large will loop if you then call \Large. Also the indentation will introduce white space in the output unless you `%` at the end of each line. I assume you would want `\Large` to be around `#2` (and inside `{}`) as otherwise it will go into the string to be indexed and sorted –  David Carlisle Oct 2 '13 at 11:46
Thanks, I totally forgot about the `%`; and wasn't sure about the compiler dependency. Updated. –  phi Oct 2 '13 at 11:55
Thank you for your help, but don't you think this command is only for the index. Also the word in index is than larger, but not in text. –  blue Oct 2 '13 at 12:06
Ooo I am confused.. The top syntax don't work.. David can you please give me an example what do you mean.. Sorry my english is not so good.. :(( –  blue Oct 2 '13 at 12:09
I see it now.. I am really confuses ;) –  blue Oct 2 '13 at 12:10

I would guess (but it is only a guess as the question has so few details) that you want

``````\newcommand{\smindexx}[2]{{\Large#1}\index{#2}}
``````

Then `\smindexx{abc}{xyz}` will typeset abc in large text at this point and make an index entry `xyz`.

As clarified in comments actually you want

``````\newcommand{\smindexx}[2]{{\Large#2}\index{#2}}
``````

and re-use `#2` twice discarding `#1`.

-
@blue yes that is the same as I wrote. –  David Carlisle Oct 3 '13 at 13:56
Carliste thank you, I will try it later ;) –  blue Oct 3 '13 at 14:08