2

When writing my own class in a subdirectory, e.g. myclass/aclass.cls, and I use the currfile package to load that class's current file path, it always returns the information of my main file only. Could someone please tell me what I am doing wrong or if it's not even possible to do?

Here is an example:

TeX sample tree

.
├── myclass
│   └── aclass.cls
├── test.pdf
└── test.tex

test.tex

\documentclass{myclass/aclass}

\begin{document}
\section{Class file: \aclassfile}
\end{document}

myclass/aclass.cls

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{aclass}
\LoadClass[a4paper, 12pt]{article}

\RequirePackage{currfile}
\edef\aclassfile{\currfilepath}

test.pdf

test.pdf image output

  • 1
    don't do \documentclass{myclass/aclass} do \documentclass{aclass} and arrange that that file is in your TEXINPUTS path. The argument to docuemntclass should be a class name not a file path – David Carlisle Jul 10 '14 at 20:16
  • Thx! Okay, I recognized that even if I put the aclass.cls into the main dir, it also doesn't resolve the right filepath. – Konstantin Möllers Jul 10 '14 at 20:21

0 Answers0