Verbesserte Ausgabe des Example-Befehls.
This commit is contained in:
parent
2f42c3f551
commit
09d11f617a
Binary file not shown.
Binary file not shown.
@ -15,6 +15,7 @@
|
|||||||
\usepackage{graphicx}
|
\usepackage{graphicx}
|
||||||
\graphicspath{graphics/}
|
\graphicspath{graphics/}
|
||||||
\usepackage{subcaption}
|
\usepackage{subcaption}
|
||||||
|
%\usepackage{floatrow}
|
||||||
|
|
||||||
\usepackage{paralist} % kompakte Listen
|
\usepackage{paralist} % kompakte Listen
|
||||||
|
|
||||||
@ -31,49 +32,67 @@
|
|||||||
|
|
||||||
\newcommand\acro[1]{\textsc{\lowercase{#1}}}
|
\newcommand\acro[1]{\textsc{\lowercase{#1}}}
|
||||||
|
|
||||||
\newcommand\widetable[1]{
|
\newcommand\widefiguremargin{-.22\textwidth}
|
||||||
\begin{table}[H]
|
\newcommand\widefigurewidth{.49\textwidth}
|
||||||
\hspace{-.199\textwidth}
|
\newcommand\widefiguregap{.02\textwidth}
|
||||||
|
\newcommand\widefiguresum{1.4\textwidth}
|
||||||
|
|
||||||
|
% Box that runs into both margins. To be used inside a floating environment like figure or table.
|
||||||
|
\newcommand\widebox[1]{
|
||||||
|
\hspace{\widefiguremargin}
|
||||||
|
\begin{minipage}{\widefiguresum}
|
||||||
#1
|
#1
|
||||||
\end{table}
|
\end{minipage}
|
||||||
}
|
}
|
||||||
|
|
||||||
\newcommand\widefigure[1]{
|
\newcommand\colrules{
|
||||||
\begin{figure}[H]
|
\rule{\widefigurewidth}{0.4pt}
|
||||||
\medskip
|
\hspace{\widefiguregap}
|
||||||
\hspace{-.199\textwidth}
|
\rule{\widefigurewidth}{0.4pt}
|
||||||
#1
|
|
||||||
\end{figure}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
% Box for example code next to the rendered example.
|
||||||
% Arguments:
|
% Arguments:
|
||||||
% 1. Label
|
% 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.
|
% 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
|
% 3. Caption
|
||||||
\newcommand\example[3]{
|
\newcommand\example[3]{
|
||||||
\widefigure{
|
\begin{figure}[htp]
|
||||||
\begin{subfigure}[b]{.69\textwidth}
|
\widebox{
|
||||||
\hrule\medskip
|
% Top rules:
|
||||||
\inputminted[breaklines]{tex}{content/#2.tex}
|
\colrules
|
||||||
\hrule\medskip
|
% Left content: code listing:
|
||||||
\caption{\LaTeX-Code}
|
\begin{subfigure}{\widefigurewidth}
|
||||||
\label{#1-code}
|
\inputminted[breaklines]{tex}{content/#2.tex}
|
||||||
\end{subfigure}
|
\end{subfigure}
|
||||||
\hspace{.02\textwidth}
|
\hspace{\widefiguregap}
|
||||||
\begin{subfigure}[b]{.69\textwidth}
|
% Right content: image or rendered example:
|
||||||
\hrule\medskip
|
\begin{subfigure}{\widefigurewidth}
|
||||||
\IfFileExists{content/#2.pdf}{
|
\IfFileExists{content/#2.pdf}{
|
||||||
\includegraphics[width=\linewidth]{content/#2.pdf}
|
\includegraphics[width=\linewidth]{content/#2.pdf}
|
||||||
}{
|
}{
|
||||||
\input{content/#2}
|
\medskip
|
||||||
\bigskip
|
\input{content/#2}
|
||||||
}
|
\medskip
|
||||||
\hrule\medskip
|
}
|
||||||
\caption{Ergebnis}
|
\end{subfigure}
|
||||||
\label{#1-result}
|
% Bottom rules:
|
||||||
\end{subfigure}
|
\colrules
|
||||||
|
% Left caption:
|
||||||
|
\begin{subfigure}[t]{\widefigurewidth}
|
||||||
|
\caption{\LaTeX-Code}
|
||||||
|
\label{#1-code}
|
||||||
|
\end{subfigure}
|
||||||
|
\hspace{\widefiguregap}
|
||||||
|
% Right caption:
|
||||||
|
\begin{subfigure}[t]{\widefigurewidth}
|
||||||
|
\caption{Ergebnis}
|
||||||
|
\label{#1-result}
|
||||||
|
\end{subfigure}
|
||||||
|
}
|
||||||
|
% General caption:
|
||||||
\caption{#3}
|
\caption{#3}
|
||||||
\label{#1}
|
\label{#1}
|
||||||
}
|
\end{figure}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user