|
|
Welcome to the TeXnik web site Fullwidth of a float |
![]() |
||||||||||
|
To get a float with a total width of text- and marginparwidth and the caption only in the margin write in
preamble (example for figure-float)
\usepackage{graphicx}
\newlength\fullwidth
\setlength{\fullwidth}{\textwidth}
\addtolength{\fullwidth}{\marginparwidth}
\addtolength{\fullwidth}{\marginparsep}
\makeatletter
\newcommand\fwfig[3]{% label tag, graphics spec, caption
\begin{figure}
\edef\fwf@side{\if@twoside \ifodd 0\fwf@pageref{#1}l\else r\fi \else l \fi}%
\makebox[\textwidth][\fwf@side]{%
\vbox to\topskip{}%
\parbox[t]{\fullwidth}{%
\centering \includegraphics[width=\fullwidth, height={!}]{#2}\par
\if\fwf@side l\raggedleft\else\raggedright\fi
\parbox[t][\z@][t]{\marginparwidth}{%
\caption{#3}\label{#1}}\par
}}%
\end{figure}%
}
\def\fwf@pageref#1{%
\expandafter\expandafter\expandafter
\fwf@secondofmany\csname r@#1\endcsname\@empty\@nil
}
\def\fwf@secondofmany#1#2#3\@nil{#2}%
\makeatother
Then you can write in the text in TeX (red) something like
some text ...
\fwfig{fig:foo}{foo.eps}{Some long caption to see what it happens...}
some more text
and a ref to \ref{fig:foo}
This code works only for the book-documentclasses, otherwise you have to
modify the code.
It's also possible to overwrite the existing figure/table float-environment if you like this for all floats.
To get the capter also over the fullwidth you can modify the above code. For a oneside article document
you can simplify it to:
|
|||||||||||