% floattrick.tex % Copyright 2008 Markus Kohm % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Markus Kohm. % % This work consists of this file only. %----------------------------------------------------------------------- \documentclass{scrartcl} \usepackage[ngerman]{babel} \usepackage{lipsum} \newlength{\Abbildungsbreite} \newcommand{\Abbildung}[1]{% \settowidth{\Abbildungsbreite}{#1}% \setcapwidth[c]{\Abbildungsbreite}% #1% } \newsavebox{\Abbildungsbox} \newenvironment{AbbildungSetztCaptionBreite}{% \begin{lrbox}{\Abbildungsbox}% }{% \end{lrbox}% \global\setbox\Abbildungsbox=\box\Abbildungsbox% \aftergroup\SetzeAbbildungsbox% } \newcommand{\SetzeAbbildungsbox}{% \Abbildung{\usebox{\Abbildungsbox}}} \begin{document} \title{floattrick-Beispiel} \author{Markus Kohm} \date{2008-09-28} \maketitle \lipsum[1] \begin{figure} \centering% \begin{AbbildungSetztCaptionBreite} % Die Abbildung wurde aus optischen Gruenden etwas breiter gewaehlt \fbox{\hspace{5em}\KOMAScript\hspace{5em}}% \end{AbbildungSetztCaptionBreite} \caption{Beispiel einer unter der Abbildung zentrierten Bildunterschrift} \end{figure} \lipsum[2] \end{document}