\documentclass[a4paper, ngerman]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}

\usepackage{eurosym, tipa, textcomp, textgreek, upgreek} % Sonderzeichen

\usepackage{amssymb, amsfonts, amsmath} % Mathezeug

\usepackage[hidelinks]{hyperref} % Referenzen als Links

\usepackage{cleveref} % mehr mit Referenzen

\usepackage{graphicx} 
\graphicspath{graphics/}
\usepackage{subcaption}

\usepackage{paralist} % kompakte Listen

\usepackage{longtable, array, tabularx, booktabs, colortbl} % Tabellenzeug

\usepackage{todonotes}

\usepackage{minted} % Quelltext-Listings

\usepackage{csquotes} % für \enquote

\newcommand\acro[1]{\textsc{\lowercase{#1}}}

\newcommand\widetable[1]{
	\begin{table}[H]
		\hspace{-.199\textwidth}
		#1
	\end{table}
}

\newcommand\widefigure[1]{
	\begin{figure}[H]
		\medskip
		\hspace{-.199\textwidth}
		#1
	\end{figure}
}

% Arguments:
% 1. Label
% 2. Content path without extension. If a corresponding PDF file exists, it gets included as an image. Otherwise, the LaTeX code gets rendered directly.
% 3. Caption
\newcommand\example[3]{
	\widefigure{
		\begin{subfigure}[b]{.69\textwidth}
			\hrule\medskip
			\inputminted[breaklines]{tex}{content/#2.tex}
			\hrule\medskip
			\caption{\LaTeX-Code}
			\label{#1-code}
		\end{subfigure}
		\hspace{.02\textwidth}
		\begin{subfigure}[b]{.69\textwidth}
			\hrule\medskip
			\IfFileExists{content/#2.pdf}{
				\includegraphics[width=\linewidth]{content/#2.pdf}
			}{
				\input{content/#2}
				\bigskip
			}
			\hrule\medskip
			\caption{Ergebnis}
			\label{#1-result}
		\end{subfigure}
		\caption{#3}
		\label{#1}
	}
}

