Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing outputdir option to minted #9

Closed
paulromano opened this issue Apr 15, 2016 · 4 comments
Closed

Passing outputdir option to minted #9

paulromano opened this issue Apr 15, 2016 · 4 comments
Assignees
Labels

Comments

@paulromano
Copy link

If using the -output-directory option for latex/pdflatex, one needs to instruct minted where to look for temporary files via its outputdir package option. However, if using minted via tcolorbox, it doesn't seem possible to pass package options to minted. Am I missing something or is this really not possible?

@paulromano
Copy link
Author

I should mention that I tried \PassOptionsToPackage{outputdir=...}{minted} and that didn't seem to work.

@T-F-S T-F-S added the bug label Apr 18, 2016
@T-F-S T-F-S self-assigned this Apr 18, 2016
@T-F-S
Copy link
Owner

T-F-S commented Apr 18, 2016

After doing several tests, I think I found the cause of the problem.

Passing options to minted via \PassOptionsToPackage{outputdir=...}{minted} does work and is IMHO the correct way to set the options. The problem is that the listing file is written to this output directory and is not found by \inputminted which is used internally by tcolorbox.

The solutions seems to be to add the output directory to the input path for \inputminted. My tests did not show any negative side effects. If nothing new comes up, I will put this change into the next tcolorbox version.

The following patch can be used meanwhile. Please, try this patch and comment, if it solves the problem for you:

\makeatletter
\def\tcb@minted@input@listing#1#2#3#4{%
  \edef\temp@a{#4}%
  \ifx\temp@a\@empty%
  \else%
    \toks@=\expandafter{#4}%
    \edef\tcb@temp{\noexpand\usemintedstyle{\the\toks@}}%
    \tcb@temp%
  \fi%
  \toks@=\expandafter{#1}%
  \edef\tcb@temp{\noexpand\inputminted[\the\toks@]}%
  \tcb@temp{#2}{\minted@outputdir#3}%
}
\makeatother

@T-F-S T-F-S changed the title Passing outpudir option to minted Passing outputdir option to minted Apr 18, 2016
@paulromano
Copy link
Author

@T-F-S Patch works great -- thanks! Look forward to the next release with this fixed.

@T-F-S
Copy link
Owner

T-F-S commented Apr 27, 2016

Fixed with version 3.91 (2016/04/27).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants