wojtask / clrs4e-solutions

Solutions to exercises and problems from "Introduction to Algorithms", Fourth Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein
Creative Commons Attribution 4.0 International
249 stars 39 forks source link

Remove redundant argument from \MakeChapter #1569

Closed wojtask closed 1 year ago

wojtask commented 1 year ago

The \MakeChapter macro typesets the whole chapter or appendix by scanning through sources in a given directory tree. As of now, it requires the 4th argument as a base directory name where to look for the sources, e.g. "chapter4", "appendixc".

These values can be determined from the \chaptertitlename and \thechapter macros, by lowercasing and concatenating them. However, LaTeX can't simply accept

\input{\lowercase{\chaptertitlename\thechapter}/sections/\Section/\Exercise}

due to internal mechanism used for expanding certain commands.

This bug is to find a working piece of code to pass to \input, and remove the redundant argument.

wojtask commented 1 year ago

The directories for the chapters have been agreed to use 2-digit numbers of chapters, e.g.: chapter01, chapter35. So the code needs to be aware of this rule to build the directory name correctly.

wojtask commented 1 year ago

I've decided to change the convention and remove the leading zeros, in order to easier automate constructing the directory names.