[Tex/LaTex] include sql files and use minted for highlighting

includemintedsql

I write in latex a documentation about a database project.

I would like to include some sql files in my latex document and highlight this files with minted.

My initial approach is the following, but it's only print my \input command.

\label{included-sql-files}
\section{SQL-Files}
\begin{minted}[lineos, framesep=2mm, fontsize=\small]{sql}
\input{./sql/01.sql}
\end{minted}

Maybe anyone else know a good solution for my problem.

Volker

Best Answer

You could use \inputminted but I would recommend to define your own command with whatever options you like (see minted documentation page 29):

\documentclass{article}
\usepackage{minted}

\newmintedfile[inputsql]{sql}{%
    linenos,
    autogobble,
    breaklines,
}

\begin{document}
    \inputsql{sql/01.sql}
\end{document}
Related Question