diff options
Diffstat (limited to 'Master/texmf-doc/doc/german/latex-tipps-und-tricks/sidefig.sty')
-rw-r--r-- | Master/texmf-doc/doc/german/latex-tipps-und-tricks/sidefig.sty | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/german/latex-tipps-und-tricks/sidefig.sty b/Master/texmf-doc/doc/german/latex-tipps-und-tricks/sidefig.sty new file mode 100644 index 00000000000..aa1d500b177 --- /dev/null +++ b/Master/texmf-doc/doc/german/latex-tipps-und-tricks/sidefig.sty @@ -0,0 +1,54 @@ +% sidefig.sty +\RequirePackage{ifthen} +\RequirePackage{calc} + +\newsavebox{\figbox} +\newlength{\leftnegwidth} +\setlength{\leftnegwidth} + {\marginparwidth+\marginparsep} +\newcommand{\@lab}{} +\newcommand{\@cap}{} +\newcommand{\@captp}{} + +% \begin{sidefig}[type]{caption}{label} +% <figure> or <table> +% \end{sidefig} +\newenvironment{sidefig}[3][figure] + { \renewcommand{\@lab}{\pageref{#3}} + \renewcommand{\@captp}{#1} + \renewcommand{\@makecaption}[2] + {\raggedright\textbf{##1}\\##2} + \renewcommand{\@cap}{\caption{#2\label{#3}}} + \begin{lrbox}{\figbox} + \begin{minipage}{\textwidth}\centering + } + % schliessender Teil + { \end{minipage}\end{lrbox} + \@float{\@captp} + % Label schon im Hilfsfile? + \ifthenelse{\equal{\@lab}{}} + % nein, dann einfach Bild drucken + {\usebox{\figbox}} + % ja, dann gerade-ungerade-Test durchfuehren + {\ifthenelse{\isodd{\@lab}} + % ungerade Seite: Legende rechts + {\parbox{\textwidth+\leftnegwidth} + {\usebox{\figbox} + \hfil + \begin{minipage}[c]{\marginparwidth} + \@cap + \end{minipage} + } + } + % gerade Seite: Legende links + {\hspace*{-\leftnegwidth}% + \parbox{\textwidth+\leftnegwidth} + {\begin{minipage}[c]{\marginparwidth} + \@cap + \end{minipage} + \hfil + \usebox{\figbox} + } + } + } + \end@float} |