gpoore / minted

minted is a LaTeX package that provides syntax highlighting using the Pygments library. Highlighted source code can be customized using fancyvrb.
1.74k stars 126 forks source link

Can't find file from custom packages #314

Closed Psyhich closed 2 years ago

Psyhich commented 2 years ago

For convenience I created my own sty file that has such content:

\ProvidesPackage{report}
\RequirePackage{cmap}

\RequirePackage[T2A]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage[english, ukrainian]{babel}

\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{minted}
\RequirePackage[most, minted, xparse, breakable]{tcolorbox}

\RequirePackage[document]{ragged2e}
\RequirePackage{graphicx}
\RequirePackage{txfonts}
\RequirePackage{geometry}
\RequirePackage{float}
\RequirePackage{listings}
\RequirePackage{xcolor}
\RequirePackage{datetime2}

\newtcbinputlisting[number within=section, list inside=mypyg]
{\codeFromFile}[5]{%
  listing engine=minted,
  minted language=#1,
  listing file=#2,
  minted options={autogobble,breaklines, #5},
  listing only,
  size=title,
  breakable,
  title={Лістинг #2 \thetcbcounter : #3 \hfill%
    \smash{\raisebox{-11pt}{}}},
    list entry=Listing~\thetcbcounter : #3,
  label=lst:#4
}

And in my main tex file I use it like this:

\documentclass[a4paper, 12pt]{article}
\usepackage{../../report}

\begin{document}
    \codeFromFile{С++}{code.cpp}{}{}{}
\end{document}

Here ../../report is a path to my sty file and code.cpp is in the same directory as tex file. On compilation I get:

Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.
muzimuzhi commented 2 years ago

In \codeFromFile{C++}..., use lowercase c++.

Psyhich commented 2 years ago

That doesn't help( Still getting the same error

Psyhich commented 2 years ago

In \codeFromFile{C++}..., use lowercase c++.

If use use c++ in newtcbinputlisting instead of #2 it's begining to work How is it related and how should I fix it to support different languages?

Psyhich commented 2 years ago

I should have used cpp instead

muzimuzhi commented 2 years ago

Strange. c++ do works for me. I can only guess that some other settings not shown in your example changed the catcode of +.

Nevermind. Congrats you find a working way.