I'm writing a little book. Within this book, I want to set examples, definitions etc. in boxes, defined similar to the one in the example below (which is an example not generated by me). Because I wanted the boxes to be floating objects, I defined a float-environment similar to those used for tables using the package float. However, the captions used for diagramms, tables... within those boxes are printed below the boxes. The float-packages description is not of any help here, as the defined caption-formats always put the caption outside the boxes.
Here's what I want to do: Define a box like in the code using mdframed, place a diagramm, a table... within this box and give a caption to that object. The caption should be place above the object within the box.
Any suggestions are welcome....
Code: Select all
Code, edit and compile here:
\documentclass[paper=A4]{scrbook}\usepackage{blindtext} %Blindtext Überprüfung von Satzspiegel/Lesbarkeit\usepackage{scrhack}\usepackage[ngerman]{babel} %Sprachpaket\usepackage[T1]{fontenc} %Sonderzeichen, Umlaute\usepackage[latin9]{inputenc} %Sonderzeichen, Umlaute\usepackage[sort,square,colon]{natbib} %Bibliography\usepackage{makeidx} %Index\usepackage{imakeidx} %Index\usepackage{fancybox}\usepackage{framed}\usepackage[tableposition=top,figureposition=top]{caption}\DeclareCaptionFont{nicered}{\color{nicered}}\captionsetup{labelfont={nicered,bf},textfont={nicered,bf}}\usepackage{subcaption}\usepackage{graphicx} %Einbinden von Abbildungen\usepackage{tikz} %TIKZ\usetikzlibrary{arrows,automata,calc,shapes,patterns,decorations,positioning,shadows,intersections,3d,decorations.pathreplacing} %TIKZ-Options\usepackage{animate}\usepackage{tcolorbox}%\usepackage{pstricks} %% erst einmal auskommentiert. Es gibt Probleme mit der "Opacity" bei TIKZ-Graphiken\usepackage[framemethod=tikz]{mdframed}\usepackage{float}\definecolor{nicered}{rgb}{.647,.129,.149}\definecolor{redtitleback}{cmyk}{0,0.1,0.1,0}\newcounter{Beispiel}[section]\newenvironment{Beispiel}[1][]{%