File: floattrick.tex

package info (click to toggle)
texlive-lang 2016.20170123-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,093,148 kB
  • ctags: 15,901
  • sloc: perl: 46,074; xml: 29,603; makefile: 5,248; sh: 3,179; python: 2,949; ansic: 2,846; ruby: 945; lisp: 726; awk: 636; java: 159; sed: 142; cpp: 12
file content (55 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
% 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}