-
Notifications
You must be signed in to change notification settings - Fork 0
Wide floats
In reports figures need to be wider than the page. However, the formatting needs to be interchangeable with proposals and AEBR reports which have normal width figures. To accomplish this we can make the figure command widen the page for reports. Then if the document class is changed, the figure command will still be defined and do the right thing.
Having wider figures, also means that you need to have wider captions. So the first thing to do is to make captions the correct width.
\RequirePackage[singlelinecheck=false,width=150mm]{caption}
While we can simply redefine the figure
environment, practically it already contains
most of the code that we want. In LaTeX every environment definition generates a macro
to begin and end it. In particular the environment x
generates the commands
\x
and \endx
.
In order to make the most of the predefined figure macros we will save the old macros under a new name so that we can still use them.
\let\oldfigure\figure
\let\endoldfigure\endfigure
We then define a new command which we want to go at the start of each figure. This serves to make the page wider, and changes the appropriate lengths to increase the effective textwidth.
\newcommand{\newfigurehead}{\hspace{-22mm}
\addtolength{\textwidth}{22mm}
\begin{minipage}[t]{\textwidth}}
We then simply redefine the \figure
command to use the saved figure
command with the new command as well. The only thing to be careful of
is that figure can take optional arguments (for the placement).
As a result we first check if optional arguments are provided, and use
them if they are.
\def\figure{\@ifnextchar[\figure@i \figure@ii}
\def\figure@i[#1]{\oldfigure[#1]\newfigurehead}
\def\figure@ii{\oldfigure\newfigurehead}
Finally we change the \endfigure
command to close the minipage we opened
in beginning the figure, then use the original \endfigure
macro to end the figure.
\def\endfigure{\end{minipage}\endoldfigure}