I'm trying to store text in a variable like \def\course{Statistics} but I want the text to be relaxed everywhere I execute the command. When I input \def\course{\relax Statistics}, the text is relaxed on the first page however after that it stops being relaxed. Example:
I define these two commands: \def\course {Statistics} \def\assignment{Written Assignment 2}
Then I run \title{\relax\course: \relax\assignment} and the heading is displayed normally like this: 
but on the 3rd page, it reverts back to this:

How can I make sure that this works everywhere?


\relaxmeans something different than what you think it means.\relaxmeans "you can stop looking for arguments to the command you're processing", not "don't worry about the formatting". Regardless, your headings look like they have some special formatting applied to them already. Could you post the minimal 20 lines of code we would need to see the result you're seeing? – Teepeemm Mar 19 '24 at 02:43\def\course {Statistics}doesn't include any formatting. It is just a string of letters. Also\title{\relax\course: \relax\assignment}isn't responsible for the output you show unless you've redefined\title. The standard\titledoesn't produce any typeset output at all. It specifies the title, but it doesn't do anything with that information.\maketitlethen produces the title. But what you show looks like a header rather than the title. – cfr Mar 19 '24 at 03:27\course*and\course. If there are more than two versions of course then use keys. – yannisl Mar 19 '24 at 03:32