LaTeX Directory Name – How to Display Directory Name?

currfile

I'm trying to use the \currfiledir command on my homework template, so I can change even less of my header every time I start a new document, see mwe:

\documentclass[letterpaper,12pt]{article}
\usepackage{lastpage}
\usepackage[realmainfile]{currfile}
\author{Brent DeJong}
\title{\currfiledir~\\ Homework ***}
\makeatletter
\let\runauthor\@author
\let\runtitle\@title
\makeatother
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\runtitle}
\rhead{\runauthor\\ Page \thepage\ of \pageref{LastPage}}
\fancyfoot{}
\begin{document}
\getmainfile
\begin{flushright}  
\runauthor \\
\runtitle \\
\today \\
\end{flushright}
\end{document}

Unfortunately, the \currfiledir command returns nothing.

I'm running TeXWorks via a MiXTeX distribution on Windows 8.1, so I don't know how to implement a commandline-based solution for this on my system. I get only the file name if I use \currfilepath or \currfilename. Is this package viable on Windows? How do I take advantage of it?

Best Answer

This here works fine for me on miktex and shows the absolute path if I compile twice with pdflatex --recorder

\documentclass{article}
\usepackage[abspath]{currfile}
\begin{document}
dir: \currfileabsdir
\end{document}
Related Question