I've been using some style file to write my thesis and it contains some weird macro definition I don't seem to understand, specifically it contains the following code to make a custom title page:

  \def\@author{{\normalsize\@by}\\{\st@author} \\[1.5\bigskipamount]%

\def\@undersup{\if@Latin Supervisor\else استاد راهنما\fi}
\def\@by{\if@Latin By\else نگارش\fi}
\def\@fordegree{\if@Latin B.Sc Thesis\else پایان‌نامه کارشناسی\fi}

These commands are then used as usual to define the content of that page:

some title
\frontmatter \makethesistitle

As the style definition only seems to be defining macros that define new macros, I don't really get what is going on here. There is seemingly no problem with this code as it outputs just what its supposed to. I'd appreciate if someone could enlighten me a little bit.

  • Note that \makethesistitle calls \origin@lmaketitle which has been set to \maketitle; that's where the actual title is constructed on the page.
    – Werner
    Jun 28 '17 at 11:21

The various commands defined using the pattern:


simply introduce a way to store a value for a field in a corresponding \st@field macro that can be used later. The effect of writing \field{value} is defining \st@field to be value. At any later point you can use \st@field to typeset value.

The actual typesetting of these values takes place in the \makethesistitle macro.

Specifically, \makethesistitle calls \origin@lmaketitle which at the beginning is let to be \maketitle which, presumably, is where the various elements \st@field are typeset in the final title page.

Consider for example:



when in your document you write


you roughly obtain


As you can see the definitions of the intermediate macros is just in preparation for the actual typesetting. This is especially useful if you are reusing the same information (for example author names) for setting up other parts of the document as the headings etc.

There is a further aspect here. In the code you provide, the class writers are reusing some default implementation of \maketitle. Since the class you are using introduces non-standard fields that are not known by the default \maketitle (which in the standard classes only uses \@title, \@author and \@date), the \makethesistitle macro is setting up the macros that the default \maketitle uses in terms of the custom \st@ prefixed ones defined by the class. (for example you see \def\@title{\st@title}).

  • Presumably \maketitle uses \@titlehead, \@title, \@subject, etc... So \makethesistitle fills them before calling \origin@lmaketitle. That is why, as specifically asked in the question, it is a macro defining new macros. Jun 28 '17 at 11:25
  • @TonioElGringo hopefully my answer is clearer now?
    – Bordaigorl
    Jun 28 '17 at 11:29
  • I still don't get it, could you augment your answer with an example of how this is expanded at compile time?
    – Paghillect
    Jun 28 '17 at 11:29
  • @Parsoa Maybe it would be clearer for you if you had a look at the source of the\maketitle macro. Specifically, the \@maketitle macro is where typesetting occurs. Jun 28 '17 at 11:34
  • @TonioElGringo If I get it correctly, all of this convoluted macro definitions is a hack to inject user specified values into the definition of \makethesistitle ?
    – Paghillect
    Jun 28 '17 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.