## LaTeX forum ⇒ General ⇒ What does \relax do? Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
mgulin
Posts: 18
Joined: Thu May 31, 2012 7:16 pm

### What does \relax do?

I'm trying to write my own document class for a report, i.e. to modify little bit LaTeX existing document class report.cls.

So.. I was just wondering, what does \relax command do? For example, I'm rewriting \maketitle command, and there is a bunch of \let\thanks\relax, \let\maketitle\relax etc. Why?

And what does \null\vfil do?

Thanks!!

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
Hi,

\relax effectively does nothing.

The example \let\thanks\relax in a way undefines \thanks. Now \newcommand*\thanks{<whatever>} wouldn't raise any errors.

In some circumstances \relax can also be used to stop some scanning process like in \ifx\mynum=1\relax (the 1 could just as well be the beginning of a larger number but \relax stops the \ifx from looking).

\null inserts an empty box (it is defined to \hbox{}).

\vfil is a vertical space that can have an arbitrary length (it fills the available vertical space, like \vspace{\fil}).

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Stefan Kottwitz
Posts: 9316
Joined: Mon Mar 10, 2008 9:44 pm
\relax does nothing. However, it is unexpandable. In some situations TeX expands commands until it reaches an unexpandable command, that's why \relax can be used to stop expansion or to indicate the end of a command.

Here, \let\thanks\relax causes that a possibly previously defined \thanks command now does nothing.

\null is just an empty (horizontal) box. For example, since some commands have no effect at the beginning of a page, you could insert such an empty box just to have something before such a command, like \vfil or \vfill. Instead of this, you could simply use \vspace*{\fil} or \vspace*{\fill}.

Stefan