2

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?

  • \currfiledir expands to nothing for the main file, because there is no complete path available, just the file name. This is confirmed by the fact that \currfilepath just shows the file name. – egreg Feb 18 '15 at 22:31
  • @egreg Is there a way I can get a complete path to be available? – dejongbrent Feb 18 '15 at 22:36

1 Answers1

3

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}
Ulrike Fischer
  • 327,261