I make a next newenvironment to insert the code of a tikzfigure in the document
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{minted}
\usepackage{tkz-fct}
\usetikzlibrary{babel, arrows, external, calc}
\usepackage{xcolor}
\definecolor{codeframe}{HTML}{2A7E43}
\definecolor{codeback}{HTML}{2B2E32}
\newenvironment{exampleTikz}
{\VerbatimEnvironment
\begin{VerbatimOut}{example.out}}
{\end{VerbatimOut}
\setlength{\parindent}{0pt}
\begin{minipage}{\textwidth}
\inputminted[
style = friendly,
fontsize=\footnotesize,
resetmargins,
frame = lines,
framesep = 2mm,
baselinestretch = 1.2,
bgcolor = codeback!15,
linenos
]{latex}{example.out}
\end{minipage}
\begin{figure}[ht]
\centering
\input{example.out}
\end{figure}
}
\begin{document}
\section{Un vector}
\begin{exampleTikz}
\begin{tikzpicture}[
scale = .75,
vector/.style = {>=latex, ->, line width = 1.5pt},
]
\tkzInit[xmin = -1, xmax = 4, ymin = -1, ymax = 4]
\tkzDrawXY[noticks]
\draw[vector] (0, 0) -- (2, 3);
\tkzPointShowCoord[xlabel = $2$, ylabel = $3$, color = gray!50](2, 3);
\end{tikzpicture}
\end{exampleTikz}
\end{document}
The result should be
but I want pass as an argument the caption to the figure, then the question is, how I can pass the caption of the figure as an argument of the newenvitonment.
Thanks a lot.