I am writing a long document which references various Profs (and their names ) in my document. I wanted to make some variable so that I can just use that whenever I wanted to write "Prof.". Is there a way to do this ?

Don't misunderstand for the "Reference", for I just wanted to write the word "Prof." using that command.

  • \def\Prof{Prof.} or \newcommand{\prof}{Prof.}, assuming there is no such command already and if it should be bold, use \newcommand{\Prof}{\textbf{Prof.}} – user31729 Nov 23 '15 at 23:34

I recommend going for


And using it like:

I'd like to thank \prof{Johnson}.

I think adding spaces at the end of commands because they get "gobbled up" is bad practice.

  • I absolutely agree with your last statement. But please note that Prof. #1 could leave a slightly too large space between "Prof." and the name in languages with \nonfrenchspacing. Christian's answer shows how to avoid that with Prof.\@ (see also tex.stackexchange.com/q/2229/35864 for much more detail and the alternative Prof.\ #1). Though I would be tempted to go for Prof.~#1 here to avoid ('Prof.//Smith') where '//' is a line break. – moewe Feb 12 at 15:42

Use \newcommand{\Prof}{Prof.\@} as a possible macro for replacing the text easily with a single change.

Be careful about using \Prof in conjunction with text later on (which is very likely), since whitespace is gobbled and the text is glued to the expansion of \Prof.

If you don't mind be struck down by the thunderbolts by egreg use xspace ;-)



Correct: Dear \Prof\ Arthur Gumby from the Ministry of Silly Walks. 

Correct: Dear \Prof{} Arthur Gumby from the Ministry of Silly Walks. 

Wrong: Dear \Prof Arthur Gumby from the Ministry of Silly Walks. 
  • Maybe even \newcommand{\Prof}{Prof.\@} (assuming it is never used at the end of a sentence) – clemens Nov 23 '15 at 23:41
  • @clemens unlikely, but can this prevent the wrapping of the name Prof. Arthur Gumby, such that Arthur Gumby goes to the next line? – user31729 Nov 23 '15 at 23:43
  • \@ affects the spacing after a dot (when \nonfrenchspacing is active). In your MWE you have the default \nonfrenchspacing which means the space after a dot (except if it follows an uppercase letter) is a little bit longer than between words. An \@ after the dot prevents this. – clemens Nov 23 '15 at 23:47
  • @clemens: Too much typographical detail for me ;-) (Thanks) – user31729 Nov 23 '15 at 23:50
  • 2
    @clemens: I would suggest to use \newcommand{\Pf}[1]{Foo} to let it expand to Prof. Foo – user31729 Nov 24 '15 at 0:01

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.