COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

Rules around \box255?

• Follow

Hello everybody,

I have a macro that saves the pages being shipped out:

\newcounter{mini@page}
\setcounter{mini@page}{1}
\newcommand*\save@page{%
\typeout{saving page \Roman{mini@page}}%
\expandafter\newsavebox\csname minipage@box\Roman{mini@page}
\endcsname
\setbox\@cclv=\hbox to \CDBL@pagewidth{\box\@cclv\hss}%
\setbox\@cclv=\vbox to \CDBL@pageheight{\box\@cclv\vss}%
\global\expandafter\setbox\csname minipage@box\Roman{mini@page}
\endcsname=\box\@cclv
\stepcounter{mini@page}%
}

This is taken from the leaflet class. Now I would like to surround
each page
with rules (to actually see the limits of the page), but when I put
\hrules inside
the \hbox I get this error:

! You can't use \hrule' here except with leaders.

Any idea of what I'm doing wrong?

Cheers!

 0
Reply nfdisco (11) 6/29/2010 11:10:33 PM

Am 30.06.2010 01:10, schrieb ernest:
....
>
> Any idea of what I'm doing wrong?
>

Use the package "eso-pic" instead. Look at the example "eso-ex4.tex".

....Rolf


 0

Le Wed, 30 Jun 2010 01:10:33 +0200, ernest <nfdisco@gmail.com> a �crit:

> with rules (to actually see the limits of the page), but when I put
> \hrules inside
> the \hbox I get this error:
>
> ! You can't use \hrule' here except with leaders.

You got to put them inside the vbox (in vertical mode). Dispite his name,
\hrule needs vertical mode, while \vrule needs horizontal mode.

--
CF

 0

On 30 Juny, 08:18, Rolf Niepraschk <Rolf.Niepras...@gmx.de> wrote:
> Am 30.06.2010 01:10, schrieb ernest:
> ...
>
>
>
> > Any idea of what I'm doing wrong?
>
> Use the package "eso-pic" instead. Look at the example "eso-ex4.tex".
>
> ...Rolf

Thanks for the suggestion. It might come in handy in a later stage,
but
right now I want to put lines around the box, which is not positioned
in the
page yet.

Bye :)

 0

On 30 Juny, 11:51, "Christoph Frings" <"c[.]frings"@laposte.invalid>
wrote:
> Le Wed, 30 Jun 2010 01:10:33 +0200, ernest <nfdi...@gmail.com> a crit:
>
> > with rules (to actually see the limits of the page), but when I put
> > \hrules inside
> > the \hbox I get this error:
>
> > ! You can't use \hrule' here except with leaders.
>
> You got to put them inside the vbox (in vertical mode). Dispite his name,=
=A0
> \hrule needs vertical mode, while \vrule needs horizontal mode.

Ah, yes, thank you!

The strangest thing happened though. The rules do not appear around
the text block, but moved to the right and to the bottom about 1 inch.
This is harder that I thought.

Cheers.

 0

ernest <nfdisco@gmail.com> wrote:

> The strangest thing happened though. The rules do not appear around
> the text block, but moved to the right and to the bottom about 1 inch.
> This is harder that I thought.

That's the funny' TeX origin. It's not the upper left corner, the
origin is moved one inch downwards and one inch to the right.

--
Heiko Oberdiek

 0

On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
> ernest <nfdi...@gmail.com> wrote:
> > The strangest thing happened though. The rules do not appear around
> > the text block, but moved to the right and to the bottom about 1 inch.
> > This is harder that I thought.
>
> That's the funny' TeX origin. It's not the upper left corner, the
> origin is moved one inch downwards and one inch to the right.
>

I am aware of the shifted origin, but I thought this would shift all
the material
in the page, not only the rules!

This is an example to illustrate what I'm talking about:

\documentclass{article}
\usepackage{geometry}
\usepackage{lipsum}
\usepackage{everyshi}
\geometry{papersize={150mm,150mm}}
\EveryShipout{%
\setbox255=\hbox to 150mm{\vrule\box255\hss}%
\setbox255=\vbox to 150mm{\hrule\box255\vss}}
\begin{document}
\lipsum
\end{document}

The rules appear not on the edge of the box. To me, it looks like it's
got
something to do with the \voffset and \hoffset parameters, but I don't
really understand what's going on here.

Cheers.

 0

ernest <nfdisco@gmail.com> wrote:

> On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
> > ernest <nfdi...@gmail.com> wrote:
> > > The strangest thing happened though. The rules do not appear around
> > > the text block, but moved to the right and to the bottom about 1 inch.
> > > This is harder that I thought.
> >
> > That's the funny' TeX origin. It's not the upper left corner, the
> > origin is moved one inch downwards and one inch to the right.
> >
>
> I am aware of the shifted origin, but I thought this would shift all
> the material
> in the page, not only the rules!
>
> This is an example to illustrate what I'm talking about:
>
> \documentclass{article}
> \usepackage{geometry}
> \usepackage{lipsum}
> \usepackage{everyshi}
> \geometry{papersize={150mm,150mm}}
> \EveryShipout{%
>   \setbox255=\hbox to 150mm{\vrule\box255\hss}%
>   \setbox255=\vbox to 150mm{\hrule\box255\vss}}
> \begin{document}
> \lipsum
> \end{document}
>
> The rules appear not on the edge of the box.

The material inside the box is already shifted because of TeX's
origin. Perhaps \AtBeginShipoutUpperLeft of package atbegshi
is a more simple solution for your problem.

--
Heiko Oberdiek

 0

On 1 Jul, 14:37, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
> ernest <nfdi...@gmail.com> wrote:
> > On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
> > > ernest <nfdi...@gmail.com> wrote:
> > > > The strangest thing happened though. The rules do not appear around
> > > > the text block, but moved to the right and to the bottom about 1 in=
ch.
> > > > This is harder that I thought.
>
> > > That's the funny' TeX origin. It's not the upper left corner, the
> > > origin is moved one inch downwards and one inch to the right.
>
> > I am aware of the shifted origin, but I thought this would shift all
> > the material
> > in the page, not only the rules!
>
> > This is an example to illustrate what I'm talking about:
>
> > \documentclass{article}
> > \usepackage{geometry}
> > \usepackage{lipsum}
> > \usepackage{everyshi}
> > \geometry{papersize=3D{150mm,150mm}}
> > \EveryShipout{%
> > =A0 \setbox255=3D\hbox to 150mm{\vrule\box255\hss}%
> > =A0 \setbox255=3D\vbox to 150mm{\hrule\box255\vss}}
> > \begin{document}
> > \lipsum
> > \end{document}
>
> > The rules appear not on the edge of the box.
>
> The material inside the box is already shifted because of TeX's
> origin. Perhaps \AtBeginShipoutUpperLeft of package atbegshi
> is a more simple solution for your problem.

The rules are not intended to be there in the final output, I'm just
using them momentarily as a visual clue.

I have a mechanism to save each page in a separate box, and
then I take these boxes and put several of them in a single
sheet of paper. This already works for the most part.

The problem I'm having is that the contents of \box255 seem
to overflow the box. What I would like is to put the contents of
\box255 in a box, but keeping everything *inside* that box.
I suppose if I could undo the shifting you talk about, I would get
what I want. But how?

Bye:)

 0

ernest wrote:
> On 1 Jul, 14:37, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
>> ernest <nfdi...@gmail.com> wrote:
>>> On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
>>>> ernest <nfdi...@gmail.com> wrote:
>>>>> The strangest thing happened though. The rules do not appear around
>>>>> the text block, but moved to the right and to the bottom about 1 inch.
>>>>> This is harder that I thought.
>>>> That's the funny' TeX origin. It's not the upper left corner, the
>>>> origin is moved one inch downwards and one inch to the right.
>>> I am aware of the shifted origin, but I thought this would shift all
>>> the material
>>> in the page, not only the rules!
>>> This is an example to illustrate what I'm talking about:
>>> \documentclass{article}
>>> \usepackage{geometry}
>>> \usepackage{lipsum}
>>> \usepackage{everyshi}
>>> \geometry{papersize={150mm,150mm}}
>>> \EveryShipout{%
>>>   \setbox255=\hbox to 150mm{\vrule\box255\hss}%
>>>   \setbox255=\vbox to 150mm{\hrule\box255\vss}}
>>> \begin{document}
>>> \lipsum
>>> \end{document}
>>> The rules appear not on the edge of the box.
>> The material inside the box is already shifted because of TeX's
>> origin. Perhaps \AtBeginShipoutUpperLeft of package atbegshi
>> is a more simple solution for your problem.
>
>
> The rules are not intended to be there in the final output, I'm just
> using them momentarily as a visual clue.
>
> I have a mechanism to save each page in a separate box, and
> then I take these boxes and put several of them in a single
> sheet of paper. This already works for the most part.
>
> The problem I'm having is that the contents of \box255 seem
> to overflow the box. What I would like is to put the contents of
> \box255 in a box, but keeping everything *inside* that box.
> I suppose if I could undo the shifting you talk about, I would get
> what I want. But how?
>
> Bye:)

have you had a look at the pgfpages package, seems to me taht it can do
most of what you are looking at

--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ:      http://www.tex.ac.uk/faq
LaTeX book:     http://www.imf.au.dk/system/latex/bog/    (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html

 0

On Thu, 1 Jul 2010 05:14:55 -0700 (PDT), ernest <nfdisco@gmail.com>
wrote:

>On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
>> ernest <nfdi...@gmail.com> wrote:
>> > The strangest thing happened though. The rules do not appear around
>> > the text block, but moved to the right and to the bottom about 1 inch.
>> > This is harder that I thought.
>>
>> That's the funny' TeX origin. It's not the upper left corner, the
>> origin is moved one inch downwards and one inch to the right.
>>
>
>I am aware of the shifted origin, but I thought this would shift all
>the material
>in the page, not only the rules!
>
>This is an example to illustrate what I'm talking about:
>
>\documentclass{article}
>\usepackage{geometry}
>\usepackage{lipsum}
>\usepackage{everyshi}
>\geometry{papersize={150mm,150mm}}
>\EveryShipout{%
>  \setbox255=\hbox to 150mm{\vrule\box255\hss}%
>  \setbox255=\vbox to 150mm{\hrule\box255\vss}}
>\begin{document}
>\lipsum
>\end{document}
>
>The rules appear not on the edge of the box. To me, it looks like it's
>got
>something to do with the \voffset and \hoffset parameters, but I don't
>really understand what's going on here.

One would think that, but LaTeX's does not actually make
any changes to \hoffset or \voffset. In fact, changes to
these offsets would not cause the problem you see, because
these offsets are applied at the moment of \shipout, when

Instead, LaTeX shifts the page by subjecting the output page
to a \moveright, using the value of \oddsidemargin or
\evensidemargin. The following is a very abbreviated part
of the definition of \@outputpage in latex.ltx:

\shipout \vbox{
% lots of initializations
\@begindvi
\vskip \topmargin
\moveright\@themargin \vbox {%
% code to place page header
\box\@outputbox
% code to place page footer
}

Unfortunately, when a box is subjected to \moveright, TeX
does not change its reference point and, if the \moveright
value is negative, the contents of the box hang out of the
left side of the box's boundary. A negative value in
\vskip\topmargin will also cause the contents to protrude
out of the top of the box.

Now, everyshi changes \shipout so that is saves the above
left of a box whose contents stick out of its boundary)
and then ships this box out.

You would need to hook into the output routine at a
point _before_ the modified \shipout saves this
\vbox. If you need to be sure that the header is taken
into account, the only place to add the top rule is
between the two lines

\moveright\@themargin \vbox {%
% code to place page header

There is no actual hook at this point in the code, or
even any macros that might be hijacked. You could
redefine \@outputbox to include the addition of this rule.
The left side rule could be added by omitting the above
\vbox, add a rule to its left and then place this
modified box with the appropriate \moveright.

Dan
To reply by email, change LookInSig to luecking

 0

On 1 Jul, 19:54, Dan Luecking <LookIn...@uark.edu> wrote:
> On Thu, 1 Jul 2010 05:14:55 -0700 (PDT), ernest <nfdi...@gmail.com>
> wrote:
>
>
>
> >On 1 Jul, 08:11, Heiko Oberdiek <heiko.oberd...@googlemail.com> wrote:
> >> ernest <nfdi...@gmail.com> wrote:
> >> > The strangest thing happened though. The rules do not appear around
> >> > the text block, but moved to the right and to the bottom about 1 inc=
h.
> >> > This is harder that I thought.
>
> >> That's the funny' TeX origin. It's not the upper left corner, the
> >> origin is moved one inch downwards and one inch to the right.
>
> >I am aware of the shifted origin, but I thought this would shift all
> >the material
> >in the page, not only the rules!
>
> >This is an example to illustrate what I'm talking about:
>
> >\documentclass{article}
> >\usepackage{geometry}
> >\usepackage{lipsum}
> >\usepackage{everyshi}
> >\geometry{papersize=3D{150mm,150mm}}
> >\EveryShipout{%
> > =A0\setbox255=3D\hbox to 150mm{\vrule\box255\hss}%
> > =A0\setbox255=3D\vbox to 150mm{\hrule\box255\vss}}
> >\begin{document}
> >\lipsum
> >\end{document}
>
> >The rules appear not on the edge of the box. To me, it looks like it's
> >got
> >something to do with the \voffset and \hoffset parameters, but I don't
> >really understand what's going on here.
>
> One would think that, but LaTeX's does not actually make
> any changes to \hoffset or \voffset. In fact, changes to
> these offsets would not cause the problem you see, because
> these offsets are applied at the moment of \shipout, when
>
> Instead, LaTeX shifts the page by subjecting the output page
> to a \moveright, using the value of \oddsidemargin or
> \evensidemargin. The following is a very abbreviated part
> of the definition of \@outputpage in latex.ltx:
>
> =A0 \shipout \vbox{
> =A0 =A0 % lots of initializations
> =A0 =A0 \@begindvi
> =A0 =A0 \vskip \topmargin
> =A0 =A0 \moveright\@themargin \vbox {%
> =A0 =A0 % code to place page header
> =A0 =A0 \box\@outputbox
> =A0 =A0 % code to place page footer
> =A0 }
>
> Unfortunately, when a box is subjected to \moveright, TeX
> does not change its reference point and, if the \moveright
> value is negative, the contents of the box hang out of the
> left side of the box's boundary. A negative value in
> \vskip\topmargin will also cause the contents to protrude
> out of the top of the box.
>
> Now, everyshi changes \shipout so that is saves the above
> vbox, executes your code (which adds rules to the top and
> left of a box whose contents stick out of its boundary)
> and then ships this box out.
>
> You would need to hook into the output routine at a
> point _before_ the modified \shipout saves this
> \vbox. If you need to be sure that the header is taken
> into account, the only place to add the top rule is
> between the two lines
>
> =A0 \moveright\@themargin \vbox {% =A0 =A0
> =A0 =A0 % code to place page header
>
> There is no actual hook at this point in the code, or
> even any macros that might be hijacked. You could
> redefine \@outputbox to include the addition of this rule.
> The left side rule could be added by omitting the above
> \moveright\@themargin, instead saving the following
> \vbox, add a rule to its left and then place this
> modified box with the appropriate \moveright.

Excellant explanation, Dan. I have sorted it out.

Thanks!


 0
Reply nfdisco (11) 7/3/2010 1:10:54 PM

11 Replies
387 Views

Similiar Articles:

7/9/2012 1:29:03 AM