How can I determine a file extension given a file path in LaTeX?

Posted by Frank on Stack Overflow See other posts from Stack Overflow or by Frank
Published on 2010-04-18T13:56:43Z Indexed on 2010/04/18 14:13 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

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}{...}

© Stack Overflow or respective owner

Related posts about tex

Related posts about latex