If I name a LaTeX file
hw1, I want to print
Homework 1. How can I do this?
I can print the string
hw1 directly using
\jobname, but I don't want spaces in my file name or have to type that out each time I make a new file.
Let's make this more general. I assume you have files named
for homeworks or
for lectures. The structure of the
How can we do? The
In this way, if the file is
As of September 2015 the code should become
You can use
That probably deserves a little unpacking.
Begin a group (you pretty much always want to wrap catcode changes in a group) and change the category code of
This line is processed in an unusual order, because of the