# [tex-live] rotating column content of a two-column document

Reinhard Kotucha reinhard.kotucha at gmx.de
Sun Jun 21 00:42:17 CEST 2015

On 2015-06-20 at 16:02:23 +0200, Reinhard Kotucha wrote:

> On 2015-06-20 at 10:07:27 +0100, Philip Taylor wrote:
>
>  > 	\setbox 0 = \hbox {\pdfliteral direct {0 1 -1 0 1050 150 cm}
>  > 		This text is rotated 90 degrees anticlockwise (0 1 -1 0)
>  > 			and translated through (1050 150) bp}
>  > 	\box 0
>  > 	\end
>
> Hi Phil,
> this doesn't work for several reasons.  First of all, hw needs
> PostScript because the PostScript interpreter has to render the bar
> codes.  So it's better to stick with DVI and use PS \special's
>
> Furthermore, the PDF operator "cm" means "concat matrix" and modifies
> the graphics state of the PDF file.  If you don't use it within a
> group, the first box is rotated by 90 degrees, the second by 180, and
> so on.  Please note that the PDF graphics state has its own grouping
> mechanism which is completely unaware of what you are doing in TeX.
>
> And TeX doesn't know that and how you modified the PDF graphics state.
> Using \pdfliteral properly is extremely difficult.  Even things which
> look easy at a first glance, like changing colors, often lead to
> unexpected results because the imaging models of PDF and TeX are
> completely different.

I've just seen on the CTAN-ann list that an update of the mathtools
package is available.  Its documentation confirms my statement.

http://mirror.ctan.org/macros/latex/contrib/mathtools/mathtools.pdf

See pp 27-28.  Similar things happened with colors before pdftex
introduced the color stack.  As far as colors are concerned, it's safe
nowadays to use LaTeX macros, AFAIK.  I doubt that page breaks in
hyperlinks can be handled properly on macro level and fear that the
problem cannot be solved without changing the behaviour of pdftex
primitives.

I've some experience with this low-level stuff since I wrote a LuaTeX
program which plots electrocardiograms.  I used Lua for signal
processing and scaling (from microvolts to millimeters) and wrote the
results directly into the PDF file.  The latter was necessary because
all existing graphics tools are too slow or produce too large files.

I could only write this program because I'm halfways familiar with TeX
programming, LaTeX internals, format files, PostScript, and the
related primitives of pdfTeX and LuaTeX.

But I definitely can't recommend casual users to go this way.  Things
are much too complex and require broad knowledge.

If there are high-level macros available, I strongly recommend to use
them.

Regards,
Reinhard

--
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at web.de
------------------------------------------------------------------