summaryrefslogtreecommitdiff
path: root/info/examples/ltt/mycap.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /info/examples/ltt/mycap.sty
Initial commit
Diffstat (limited to 'info/examples/ltt/mycap.sty')
-rw-r--r--info/examples/ltt/mycap.sty42
1 files changed, 42 insertions, 0 deletions
diff --git a/info/examples/ltt/mycap.sty b/info/examples/ltt/mycap.sty
new file mode 100644
index 0000000000..d36901021a
--- /dev/null
+++ b/info/examples/ltt/mycap.sty
@@ -0,0 +1,42 @@
+% MYCAP.STY
+\RequirePackage{ifthen}
+
+% Fonts fuer Numerierung und Rumpf
+\newcommand{\capfont}[1]{\textit{#1}}
+\newcommand{\fnumfont}[1]{\textbf{#1}}
+
+% Linksbuendig {} oder zentriert {\centering}
+\newcommand{\capshape}{}
+
+% Form der Numerierung, Default: "Abbildung 0.3: "
+% Beispiel "mit Strich abgetrennt":
+% \renewcommand{\fnumshape}[1]
+% {\rule{\linewidth}{0.5pt}\\#1 }
+\newcommand{\fnumshape}[1]{#1: }
+
+% false: Legende direkt nach Numerierung
+% true: Zeilenumbruch nach Numerierung
+\newboolean{capbreak}
+\setboolean{capbreak}{false}
+
+\renewcommand{\@makecaption}[2]
+{\vspace{\abovecaptionskip}
+ % Laenge der Legende bestimmen
+ % Nummer abgesetzt: nur Textlaenge zaehlt
+ \ifthenelse{\boolean{capbreak}}
+ {\sbox{\@tempboxa}
+ {\capfont{#2}}}
+ {\sbox{\@tempboxa}
+ {\fnumfont{\fnumshape{#1}\capfont{#2}}}}
+ % mehrzeiliger Eintrag?
+ \ifthenelse{\lengthtest{\wd\@tempboxa>\hsize}}
+ {{\capshape\fnumfont{\fnumshape{#1}}%
+ \ifthenelse{\boolean{capbreak}}{\\}{}%
+ \capfont{#2}}
+ }
+ {{\capshape\fnumfont{\fnumshape{#1}}%
+ \ifthenelse{\boolean{capbreak}}{\\}{}%
+ \capfont{#2}}
+ }
+ \vspace{\belowcaptionskip}
+} \ No newline at end of file