I am dealing with a proprietary .cls file, which has a lot of constructions that work like this: a capitalized Macro (made-up, not existing in the packages loaded) is def'ed to be the lower-case version of this macro(also made up). This macro is then later used to def or (re)newcommand other stuff, relating to packages or simply for layout. - My question is threefold:
- Why does the syntax
\def\MyCoverText#1work at all? - I read this description of\def, and it does not seem to allow for a non-braces-encapsulated first argument, so i'd have thought it would need to be\def\MyCoverText[#1] - What is the upside of the
\def\C#1{\def\c{#1}}construct? I tentatively replaced it by a direct def of command, and it seems to work like before. - Is there a name for C->c, or for the practice of saying C#1 instead of C[#1]?
.cls file:
\ProvidesClass{myclass}[My class]
\LoadClass[10pt]{article}
\def\MyCoverText#1{\def\mycovertext{#1}}
\MyCoverText{Hello World}
% i replaced the two above lines by:
% \def\mycovertext{Hello World}
% to no obvious ill effect
\newcommand{\mycover}{
\thispagestyle{empty}
\newpage\null\vskip 3em%
\begin{center}
\mycovertext
\end{center}%
}
.tex file:
\documentclass{../myclass}
\begin{document}
\mycover
\end{document}
EDIT: pertaining to my confusion about \def, spurred by David Carlisles comments on it, i found this, which offers a host of different \def syntax versions and what they do. Really usefull stuff
\def\C#1{\def\c{#1}}The usual use is something like\def\title#1{\def\@title{#1}}which allows the author to use\title{my title}and have it internally saved in\@titlefor use by\maketitle(your use of camelcase for the user level command doesn't really follow latex naming guidelines) – David Carlisle Apr 30 '20 at 09:41\def\foo#1{}\nd\def\foo[#1]{}define completely different syntax, so it depends which you need. – David Carlisle Apr 30 '20 at 09:42\c! That is the canonical command for a cedilla. (You have no idea what consternation it produces among a journal's editorial staff when suddenly a French name is corrupted by such a thoughtless substitution.) Don't (re)define one-letter control sequences, Ever. Please. – barbara beeton Apr 30 '20 at 14:33amsmathuser guide, so I am suitably chastened (since I helped write the thing). It's never a good idea to tantalize newbies with such suggestions -- they too often follow them rather blindly. Sigh. – barbara beeton Apr 30 '20 at 21:07