Is it possible to set specific margin sizes for tables and images on the pages?
Example, my pages have 3cm left margin but for tables and images I would like to set 2cm left margin.
The best solution would be set this parameters into .cls file but how to do it? Setting this parameters into .tex file is also acceptable solution for me.
I include images using figure environment.
Thank you in advance.
Page Layout ⇒ Local margin for tables and images
NEW: TikZ book now 40% off at Amazon.com for a short time.
-
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Local margin for tables and images
It's not easy, but it's possible. Try this:
My example gives overfull hbox warnings, but the output sounds like what you're looking for.
Code: Select all
\newlength{\extrawidth}%
\setlength{\extrawidth}{1cm}%
\newenvironment{wfigure}[1][tbp]{%
\begin{figure}[#1]
\hspace{-\extrawidth}%
\addtolength{\textwidth}{2\extrawidth}%
\begin{minipage}{\textwidth}%
}{\end{minipage}\end{figure}}
\newenvironment{wtable}[1][tbp]{%
\begin{table}[#1]
\hspace{-\extrawidth}%
\addtolength{\textwidth}{2\extrawidth}%
\begin{minipage}{\textwidth}%
}{\end{minipage}\end{table}}
Local margin for tables and images
A variation on kaiserkarl13's solution, using the adjustwidth environment provided by the changepage package (no bad boxes will be produced):
The documentation for the package can be found in the file changepage.sty itself.
Code: Select all
\documentclass{book}
\usepackage[lmargin=3cm]{geometry}
\usepackage{changepage}
\usepackage{lipsum}% just to automatically generate text
\newenvironment{myfigure}[1][tbp]{%
\begin{figure}[#1]\begin{adjustwidth}{-1cm}{}}
{\end{adjustwidth}\end{figure}}
\newenvironment{mytable}[1][tbp]{%
\begin{table}[#1]\begin{adjustwidth}{-1cm}{}}
{\end{adjustwidth}\end{table}}
\begin{document}
\lipsum[1]
\begin{myfigure}[!ht]
\centering
\rule{\linewidth}{3cm}
\end{myfigure}
\lipsum[1]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...