# What do these commands specifically do?

``````\makeatletter
\providecommand*{\input@path}{}
\makeatother
``````

I understand:

``````\makeatletter
\makeatother
``````

are just necessary for redefining macros or something.

``````\providecommand
``````

just takes the current macro `input@path` and clears it.

``````\g@addto@macro
``````

I do not fully understand what this does.

``````{./level1//}{./level1/level2//}{./level2//}}
``````

Nor this. Does it tell the input path that these are all directories which may be invoked directly?

You provide several interpretations of what various commands do.

`\makeatletter` and `\makeatother` are just necessary for redefining macros or something.

Not quite. By default, the character `@` is not allowed to occur in the name of a TeX or LaTeX macro; instead, valid multi-character macro names must consist of uppercase and lowercase letters exclusively or, more precisely, of characters with category code "letter". (By default, the only characters with catcode "letter" are, you guessed, uppercase and lowercase letters.) The instruction `\makeatletter` changes the catcode of `@` from "other" to "letter", making it syntactically legal to use the `@` character in multi-character macro names.

Why go through these steps? For by-now mostly historic reasons, LaTeX-internal commands often (but not exclusively) use one or more `@` characters; this presumably makes it much less likely that "ordinary" users execute them by accident. `\makeatletter` lets you get over this (admittedly not very high) hurdle, and `\makeatother` restores the default catcode of `@`.

`\providecommand` just takes the current macro `\input@path` and clears it.


``````\providecommand*{\input@path}{}
``````

is to make sure that the next instruction, viz., `\g@addto@macro\input@path{{./level1//}{./level1/level2//}{./level2//}}`, doesn't crash and burn in case a macro with the name `\input@path` hasn't been defined already.

Finally, let's turn to

`\g@addto@macro\input@path{{./level1//}{./level1/level2//}{./level2//}}`

The macro `\g@addto@macro` -- note the presence of two [2!] `@` characters -- is a low-level LaTeX kernel command which takes two arguments: The first is the name of an existing macro (here: `\input@path`); the second is some additional material to be appended to the macro named in the first argument.

Let's assume that the macro `\input@path` is either blank (because it was created by the preceding `\providecommand` instruction) or contains a syntactically valid path. The `\g@addto@macro` instruction appends

``````{./level1//}{./level1/level2//}{./level2//}
``````

to that macro.

Not knowing where you obtained this code snippet from or what it is supposed to do, I'm afraid I can't add anything more in terms of explanation or interpretation.

• Very good explanation. – Sveinung Aug 25 '19 at 20:41
• @Sveinung - Many thanks for the compliment -- and for the typo fixes! – Mico Aug 25 '19 at 21:25