Page Layout ⇒ Local margin for tables and images
Local margin for tables and images
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.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
kaiserkarl13
- Posts: 707
- Joined: Tue Mar 25, 2008 5:02 pm
Local margin for tables and images
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
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}