What exactly happens in:
\newcommand{\mystring}[1]{\gdef\@mystring{#1}}
when \mystring{mystring} is used later in the document? It is known that mystring will be put in \mystring but I would like to know how in a Latex sense.
Edit: More information is given below. My programming skills in general and especially my Latex programming skills are decently low. I want to prepare a template for conference proceedings where specific information should be stored in appropriate strings that can be used later. Typically, authors' names could be stored in a variable that we will call \AuthorNames so that \AuthorNames (or more exaclty \@AuthorNames as indicated by Ulrike) can be indicated in the right footer of the paper for instance. Since I do not know much, I decided to mimic existing Latex classes (probably the article class). By travelling through the class examples, I figured out that:
\newcommand{\AuthorNames}[1]{\gdef\@AuthorNames{#1}}
was doing was I needed. I can know reformulate my question through a comparison with FORTRAN. What is the LaTeX version of:
CHARACTER :: AuthorNames
Or in other terms, is there a LaTeX guide somewhere saying: "if you want to declare a string of characters in LaTeX", use this: [blablabla]. I should probably read "texbytopic", that's all.
\gdefis like\newcommandexcept it does not complain of the command is already defined and the definition is global so is not lost at the end of the next{ }group or environment. So basically\mystring{mystring}does\newcommand\@mystring{mystring}– David Carlisle Sep 07 '12 at 11:36\@mystringcontains the stringmystring. Is this just the default functioning of such command? (in other words, is this the only way to assign a string of characters to a command in Latex) – pluton Sep 07 '12 at 12:17\mystringbut in\@mystring. That's a different command. The purpose of\mystringis 1. to give a better interface. users can store a string with\mystring{string}instead of having to do\gdef\@mystring....and 2. in this way you can store the value in a command with @ in its name which can't be changed easily by a user and so it is (a bit) protected. – Ulrike Fischer Sep 07 '12 at 13:57