OthersHow can I use a keyval as parameter for minted?

Information and discussion about other tools not listed above.
Post Reply
acombo
Posts: 2
Joined: Fri Apr 20, 2012 10:32 am

How can I use a keyval as parameter for minted?

Post by acombo »

I'm trying to use minted inclusion of source code in a document. Everything works fine if I write (or use a command) as the filename, but if I first store the filename in a key (using keyval) an error occurs and mint does not recognizes the file. Bellow is the code... and the line (commented) that gives the error, and the error itself. Thanks for you help.

Code: Select all

Code, edit and compile here:
\documentclass{article}
% Preamble Setting for {minted} package
\usepackage{minted}
\usemintedstyle{friendly}
% Specify Custom Styles for minted Source Codes
\newmintedfile[codec]{c}{linenos=true}
\usepackage{keyval}% http://ctan.org/pkg/keyval
\newcommand{\tempsrc}{./tmpsrc/} % Just a path!
\newcounter{cntTmp}
\makeatletter
\newcommand{\gitRepoDir}{S:/temp/git_test/}
\newcommand{\tmpSrcDir}{./tmpsrc/}
\newcommand{\mysome}[1]{#1}
% \gFile{<Init Directory>}{<Tag>}{<Source Directory>}{Filename}
\newcommand{\gFile}[4]{
% Define Key
\define@key{}{fdTmp\arabic{cntTmp}}[]{tmp#2#4}
\stepcounter{cntTmp}
}
\makeatother
\begin{document}
- Add a key.
\gFile{src}{first-tag}{./}{test.txt}
- End Key creation. \newline
- Verify SETKEYS (for fdTmp0): \setkeys{}{fdTmp0} \newline
-- At this point assume the following files exist:\newline
+++++ \setkeys{}{fdTmp0} \newline
- Now the minted command WITH file name.
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply