So, you can consider the following solution (packages required: graphicx, calc):
\newlength\largefigure % to create a new length
\setlength{\largefigure}{\columnwidth+\marginparsep+%
\marginparwidth} %%% to set largefigure as the sum of the
%%% width of the text, of the width of the margin note and
%%% of the width of the white spaces between the thext and
%%% the margin note.
%%
\begin{figure}%
\centering%
\makebox[\textwidth][r]{% %%% you make a box which width is
%%% not important for the contents of the box itself
%%% (\textwidth) and which will flush [r] from the right
%%% ([l] from the left) margin of the text; whatever doesn't
%%% find place in the box will exceed in the opposite side.
%%% Please note that a curly brace is still open.
\includegraphics[width=.8\largefigure]{figurename} %%% you
%%% can now include your graphic with the usual option for
%%% \includegrephics
} %%% Here you "close the box"
\caption{This is the caption\dots}%
\label{fig:label}%
\end{figure}
In this case, you can't see anything special but the absence of the overfull hbox message in your log file, even if your figure is larger than the standard textwidth and, more important, if your figure is on odd page, it would flush left.
This trick is more useful while including subfigure on the same line (subfig package required), because if the total horizontal amount of the figures is wider of the textwidht, LaTeX put the second one in a new row and you can't use the white external margin:
\newlength\largefigure %%% as above
\setlength{\largefigure}{\columnwidth+\marginparsep+%
\marginparwidth} %%% as above
%%
\begin{figure}%
\centering%
\makebox[\textwidth][l]{% %%% as above; this time, the
%%% figures flushes from the left
\subfloat[Sunfigure (a) caption.\label{fig:sfalabel}]%
{\includegraphics[width=.48\largefigure]{figurename}}%
\hfill%
\subfloat[Subfigure (b) caption.\label{fig:sgblabel}]%
{\includegraphics[width=.48\largefigure]{figurename}}%
}
\caption{Figure's caption.}%
\label{fig:figlabel}%
\end{figure}
And now... What if you want to insert in the figure environment not a single or multiple \includegraphics element, but something else? For example, a tikz picture contented in an external file? How can you warranty the width of the picture?
\begin{figure}
\centering
\subfloat[A big tikz picture.\label{fig:one}]{%
\makebox[\textwidth][l]{% %%% as above
\resizebox{.45\largefigure}{!}{%
\input{fig/tikzfile}}}}%
\hfill%
\subfloat[Another big tikz picture.\label{fig:two}]{%
\makebox[\textwidth][l]{% %%% as above
\resizebox{.45\largefigure}{!}{%
\input{fig/tikzfile}}}}%
\caption{Two tikz pictures}
\label{fig:label}
\end{figure}
Please note: the hint for this post come from this thread on guit forum.
Nessun commento:
Posta un commento