When I insert an image into LyX and set it to 100% page width, its left side is not at the farthest most edge of the left page. Instead it starts where the text margin is, and since it's too large to display, it cuts off on the right. Is there a way to set a different margin for figures than that of the text?
2 Answers
The horizontal image shift is due to the paragraph indent if you don't place the image inside a figure environment. To avoid this without inserting a figure environment, insert an ERT (or Ctrl+L) just before the image that contains \noindent. This removes the paragraph indent so that the image will fit within the text block.
- 603,163
-
the margin is still there. did you mean \nomargin? I tried that but it didn't work either. – waspinator Feb 10 '12 at 19:50
-
@waspinator: It sounds like the original problem deals with the image being pushed out into the right margin. This is typically caused when the image is set to the text block width
\textwidthbut with a paragraph indent. Hence the suggestion to use\noindent, which removes the paragraph indent. Are you actually setting the image to the text block width, or the page width? – Werner Feb 10 '12 at 19:54 -
I set the image to page width since it's large. Basically I wanted to apply a different margin to the image than the text. Thanks. – waspinator Feb 14 '12 at 22:14
-
@waspinator: Well, if you want to modify the text block margins on the fly, than can also be done using the
changepagepackage. You could update your original question with some more detail on specifically what you're after. You could even provide a screen shot, even if its produce in something else (like MS Word). It really helps in assessing what your best options are. – Werner Feb 14 '12 at 22:22
To make your graphics span the full paper widht, you need a negative \hskip to compensate for the left margin. Hence, add something like this in an ERT box directly before your graphics:
\hskip\dimexpr-\hoffset-1in-\oddsidemargin-\leftskip\relax
This assumes, however, that the float will be placed on an odd page. Depending on the document class and layout options, the page margins on odd and even pages may differ. To take this into accout requires a somewhat bigger effort. Add the following to your preamble (Document->Settings->LaTeX Preamble):
\usepackage{changepage}
\strictpagecheck
\newlength{\totalleftmargin}
\newcommand{\calctotalleftmargin}{%
\setlength{\totalleftmargin}{\dimexpr+\hoffset+1in+\leftskip}%
\checkoddpage%
\addtolength{\totalleftmargin}{\ifoddpage\oddsidemargin\else\evensidemargin\fi}%
}
The ERT box directly before your graphics does then become:
\calctotalleftmargin
\hskip-\totalleftmargin\relax
- 37,517
lyxbut if you can go into the code then you can use theadjustwidthenvironment from thechangepagepackage – cmhughes Feb 07 '12 at 21:05