views:

45

answers:

1

I am attempting to write a LaTeX package which leverages the minted package's \inputminted command. My \mycommand command takes two parameters, the first being a path to a file, and I want to pass the file's extension to the \inputminted command:

\newcommand\mycommand[2]{
  \inputminted{#1}{...}
}

Note that the above won't work since the full path is passed to \inputminted.

Example:

\mycommand{/path/to/Test.java}{blah}

should invoke

\inputminted{java}{...}
+1  A: 

In your package use the function \filename@parse

\filename@parse{/path/to/Test.java}

then you can access the results using

\filename@base
\filename@ext

So in your case

\inputminted{\filename@ext}{...}
Niall Murphy
Awesome Niall - thank you so much! Do you have a reference to the \filename@parse function somewhere?
Frank
No I can't find a reference. I just grepped through my texmf folder and found a package called fink doing something similar. Maybe the lack of documentation is related to this question: http://stackoverflow.com/questions/2296772/where-can-i-find-help-files-or-documentation-for-commands-like-startsection-for
Niall Murphy