Uwe Lueck uwe.lueck at web.de
Mon Dec 19 21:17:54 CET 2011

Looking at all the texhax postings with "Question" in their subject in my mailbox ...

"Vafa Khalighi" <vafaklg at gmail.com> wrote 16.11.2011 13:24:45:
> \documentclass{article}
> \TeXXeTstate=1
> \begin{document}
> \everypar\expandafter{\the\everypar \setbox0\lastbox \ifvoid0\else\beginR\usebox0\fi}
> \hsize=\linewidth
> \divide\hsize 2
> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
[ SNIP ]
> \end{document}
>
> text ends up in the left block, instead the right block.
> Can someone explain why and if there could be a way to fix this?

I do not want to give a complete explanation right now, just mention a
principal aspect with LaTeX (latex.ltx):
Setting \hsize affects TeX's primitive typesetting of paragraphs only.
LaTeX, in contrast, also considers \textwidth, \linewidth, and \columnwidth
(and ...?). If you really want to ..., you must add

\textwidth\hsize \linewidth\hsize \columnwidth\hsize

... (you may know ...) otherwise ... well, I do not know what you want, it really depends ...

Another LaTeX aspect (back to earlier code of yours):
> \everypar\expandafter{\the\everypar [ SNIP ]

Modifying \everypar with LaTeX may work for a few paragraphs ...
in the long run, LaTeX sometimes just sets \everypar{},
destroying all ideas of package writers about using \everypar.

Back to your earlier code for horizontal direction:
> \TeXXeTstate=1

I guess this does not work with all engines and formats ...

> \begin{document}
> \everypar\expandafter{\the\everypar \setbox0\lastbox \ifvoid0\else\beginR\usebox0\fi}

Sorry, I cannot find out quickly what you expect \beginR to do ...
Maybe beginning at the right margin?

> text ends up in the left block, instead the right block.
> Can someone explain why and if there could be a way to fix this?

... in case of that guess, don't use \beginR ...

... or just

(moving the type area you have got so far to te left margin ...)
... i.e., I cannot offer more help at this point of knowing what you are doing
and what you want to achieve ...

The geometry package offers a straightforward way
for passing your ideas of placing the type area on the page
in a consistent way to LaTeX.

Cheers,

Uwe.