Assume the file, source.tex is placed in /home/user/Birds/ and the user types context source.tex to compile the file. Is there a way for ConTeXt to retrieve the name of the folder that the file is located in (in this example, "Birds"), for use as a variable? This might be used, for example, to give the document a title, e.g. \title{\directoryname}.
- This will only be used on a Linux system and needn't be compatible with other systems.
- Directory names with spaces might appear, e.g.
/home/user/Tropical\ Fish/.
\directlua {tex.sprint (lfs.currentdir())}. – Philipp Gesang Feb 23 '14 at 10:06