PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : \thepage does not work in floats



Pieter Segers
31-08-2004, 18:40
Hello,

I´m writing Latex in "twoside" layout, so margins will change from page to page. I have a lot of figures that I need to present, and I wanted to arrange them two next to each other, as can be done with the minipage environment. Because they are too small if I keep the width the same as the textwidth, I wanted them to be a couple of centimeters bigger, which should be possible because there is a relatively large whitespace at the outer side of each page (due to the "twoside" layout).

Because the location of this whitespace depends on if the figure is on the right or left page, I wrote:

\ifodd\thepage\hspace*{0cm}\else\hspace*{-3cm}\fi
\makebox[\textwidth+3cm]{
\begin{minipage} ...

which should check if the page is odd or even, and substract 3cm if needed.

Now, I placed all this in a new command, so I can call it into a figure environment, which works beautifully, exept for:

Sometimes, the figure moves to an other page (which is of course the whole idea of a "float" environment) and in this case everything will go wrong, because the \thepage variable is set with the pagecounter value from the page on which the text(code) is called, and NOT with the value on which the float is put.

For example: I call this new command from page 30, which shifts the contents of the figure 3cm to the left because of the big whitespace on the left of even pages, but the float itself is put on page 31 and falls off the page due to the shifting.

I looked for commands to redefine margins with the use of floats, or to custom float placement, but up to now I did not found anything helpful. Of course, I can define the placement manually for every figure, but then I would have to change them all every time I add some text. I would like to keep this automated and I would really appreciate it if someone could give me some advice concerning this problem.

Pieter
(please do reply in German, I´m only not able to write it correctly)

fireglow
10-02-2006, 15:00
here is a hint for custom float positioning

usepackage{float}

\begin{figure}[H]

that should solve your problem