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

Reinhard Kotucha reinhard.kotucha at gmx.de
Sat Jun 20 16:02:23 CEST 2015

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.

The best way to avoid these problems is to use \rotatebox from the
graphics package.  It takes care of these things.

---------------------------------------------------------------------
\documentclass[10pt, twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[paperwidth=86mm, paperheight=83mm, top=2mm, bottom=2mm,
left=2.5mm, right=2.5mm]{geometry}
\usepackage{pst-barcode}
\usepackage{graphicx}
\setlength{\columnsep}{3mm}
\setlength{\parindent}{0pt}
\begin{document}

\rotatebox{90}{\parbox[t]{79mm}{
foo bar text
\par\vspace{0.3in}
\psbarcode{content of qrcode}{height=0.35 width=0.35}{qrcode}
\par
\textbf{asdf, xcas}}}
\newpage

\rotatebox{90}{\parbox[t]{79mm}{
foo bar text
\par\vspace{0.3in}
\psbarcode{content of qrcode}{height=0.35 width=0.35}{qrcode}
\par
\textbf{asdf, xcas}}}
\newpage

\rotatebox{90}{\parbox[t]{79mm}{
foo bar text
\par\vspace{0.3in}
\psbarcode{content of qrcode}{height=0.35 width=0.35}{qrcode}
\par
\textbf{asdf, xcas}}}
\newpage

\rotatebox{90}{\parbox[t]{79mm}{
foo bar text
\par\vspace{0.3in}
\psbarcode{content of qrcode}{height=0.35 width=0.35}{qrcode}
\par
\textbf{asdf, xcas}}}
\newpage

\end{document}
---------------------------------------------------------------------

You need latex (not pdflatex) and dvips.  You can convert it to PDF
for previewing (ps2pdf -dAutoRotatePages=/None) but in order to print
the labels this step is not necessary.

The next step will be to find out how to use Ghostscript in order to
convert the PostScript code to something the printer understands.  I
already posted an example for PCL printers but the paper size has to
be set explicitly in this case.

The PostScript file contains the line

%%BoundingBox: 0 0 244 236

hence the relevant Ghostscript options are

-dDEVICEWIDTHPOINTS=244 -dDEVICEHEIGHTPOINTS=236

http://tug.org/pipermail/tex-live/2015-June/036930.html
http://www.ghostscript.com/doc/9.16/Use.htm#Paper_size

Regards,
Reinhard

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