<div dir="ltr"><div>Hi all,</div><div><br></div><div>just to summarize:</div><div><br></div><div>\def, \edef, \gdef, \xdef, \let, \chardef, \mathchardef are primitives, they work always without any check. You can damage anything if you are not careful.</div><div><br></div><div>\newcommand defines a new (fragile) macro (without a star it is \long), reports an error if already exists</div><div><br></div><div>\renewcommand reports an error if the macro does not exist</div><div><br></div><div>\DeclareRobustCommand defines a robust macro (\long without a star), no checks</div><div><br></div><div>\providecommand defines a macro only if it does not exist, it is not an error if it already exists, the existing definition will not be changed</div><div><br></div><div>\newcommand\relax{be happy} will tell you that it is an error but \gdef\relax{be happy} will be executed without an error and it will probably be the last thing in your LaTeX document which will work, \providecommand\relax{be happy} will do nothing, \renewcommand assumes that you know what you are doing, hence you should know why you want to destroy the whole LaTeX kernel by redefining \relax...</div><div><br></div><div>If you know what you are doing, and when preparing package-like macros you should know it, there is no reason for not using the primitives directly. For instance, in one document I want \label to do another action with its argument. I believe that it will always have one argument but the code of \label can be changed in the future. Thus I store its current definition, define my addition and then call the original macro. This can be done with \let and \def, not with \newcommand:</div><div><br></div><div>\let\savedLabel\label</div><div>\def\label#1{Do something with #1 \SavedLabel{#1}}</div><div><br></div><div>The second line could be replaced with</div><div>\renewcommand*\label[1]{Do something with #1 \SavedLabel{#1}}</div><div><br></div><div>\providecommand is useful if you assume that a definition exist but you want to provide a default definition.</div><div><br></div><div>The newcommand family is useful because it offers a default first argument but if you use arguments with the newcommand family, use always the star version so that the macro is not \long. If you forget a right brace after an argument, you will get an error message at the end of a paragraph but without  the star you get an error message at the end of a file hence it is difficult the source of the error.</div><div><br></div><div>Construct \csname scenename\endcsname expands to the contents of \scenename if already defined or is defined to be identical with \relax if not yet defined. When checking existence of definition, LaTeX does the following:</div><div><br></div><div>\expandafter\ifx\csname scenename\endcsname\relax</div><div>  code for \scenename not yet defined</div><div>\else</div><div>  code for \scenename already defined</div><div>\fi</div><div><br></div><div>Of course, the whole \else part can be omitted if you have nothing to put there.</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Zdeněk Wagner<br><a href="http://ttsm.icpf.cas.cz/team/wagner.shtml" target="_blank">http://ttsm.icpf.cas.cz/team/wagner.shtml</a><br><a href="http://icebearsoft.euweb.cz" target="_blank">http://icebearsoft.euweb.cz</a></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">ne 12. 4. 2020 v 12:49 odesílatel Ross Moore <<a href="mailto:ross.moore@mq.edu.au">ross.moore@mq.edu.au</a>> napsal:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
Hi Phil, Zdeněk and others.
<div><br>
<blockquote type="cite">
<div>On 12 Apr 2020, at 7:46 pm, Philip Taylor <<a href="mailto:P.Taylor@Hellenic-Institute.Uk" target="_blank">P.Taylor@Hellenic-Institute.Uk</a>> wrote:</div>
<br>
<div>
<div bgcolor="#FFFFFF">
<div>Zdeněk Wagner wrote:<br>
<br>
</div>
<blockquote type="cite">
<pre>I would not do it. Of course, you cannot use \renewcommand because
\scenename is not used in any *.ldf. You could use \def\scenename{दरश्य} […]
</pre>
</blockquote>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>LaTeX has  \providecommand  with the same syntax as \newcommand  and  \renewcommand .</div>
<div><br>
</div>
<div>It makes the definition *only* if the c-s is not already known.</div>
<div>This means that you can always use:</div>
<div><br>
</div>
<div>  \providecommand\mycs{}</div>
<div>  \renewcommand\mycs{ what I really want }</div>
<div><br>
</div>
<div>to get around such issues.</div>
<br>
<blockquote type="cite">
<div>
<div bgcolor="#FFFFFF">
<blockquote type="cite">
</blockquote>
<br>
A thought — if \scenename is not known at the point that the last line of [gloss-]marathi.ldf is read, would there be any point in using \def \scenename {दरश्य}, since such definition would either get over-ridden by whatever subsequent definition of \scename
 is causing the problem (\def, \renewcommand), or would prevent a subsequent \newcommand from working as \scenename would already be defined.  Is this not the case (he asked, as someone who barely understands anything that LaTeX does ...) ?<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>There is always a way to get what you want,</div>
<div>whether using Plain TeX or LaTeX or whatever other high-level macro structures.</div>
<div><br>
</div>
<div>Thus the important thing is how to make it resistant to updates, as Zdeněk said.</div>
<br>
<blockquote type="cite">
<div>
<div bgcolor="#FFFFFF"><br>
<i>Philip Taylor</i><br>
</div>
</div>
</blockquote>
</div>
<div><br>
</div>
Hope this helps.
<div>Stay safe.</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>Ross</div>
<div><br>
<div><br>
Dr Ross Moore<br>
Department of Mathematics and Statistics 
<div>12 Wally’s Walk, Level 7, Room 734<br>
Macquarie University, NSW 2109, Australia<br>
T: +61 2 9850 8955  |  F: +61 2 9850 8114<br>
M:+61 407 288 255  |  E: <a href="mailto:ross.moore@mq.edu.au" target="_blank">ross.moore@mq.edu.au</a><br>
<a href="http://www.maths.mq.edu.au" target="_blank">http://www.maths.mq.edu.au</a><span style="font-size:12px;line-height:normal"><a href="http://mq.edu.au/" style="font-size:12px;line-height:normal" target="_blank"><span><br style="color:rgb(0,105,217);font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:Arial,sans-serif">
<span style="color:rgb(0,105,217);font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:Arial,sans-serif"><span><span><span><span><img id="gmail-m_-27467992843092221DBB09322-10CA-450A-B6D3-03F326FD230A" src="cid:1716e91b7054cff311"></span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">CRICOS
 Provider Number 00002J. Think before you</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">print. </span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">Please
 consider the environment before printing this</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">email.</span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">This
 message is intended for the addressee named</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">and
 may </span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">contain
 confidential information. If you are not the</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">intended </span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">recipient,
 please delete it and notify the sender. Views</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">expressed </span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">in
 this message are those of the individual sender, and</span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline"> </span><span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">are
 not </span><br style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none">
<span style="font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;color:rgb(0,0,0);font-family:Helvetica;text-decoration:none;float:none;display:inline">necessarily
 the views of Macquarie University.</span> </span></span></span></span></span></a></span></div>
<a href="http://mq.edu.au/" style="font-size:12px;line-height:normal" target="_blank"></a></div>
<br>
</div>
</div>

</blockquote></div>