[pdftex] Reply to "text rotation" in plain TeX

Brad Burkman BBurkman at lsmsa.edu
Wed Apr 8 14:14:17 CEST 2009

I have rotated text in plain Tex.  It's not hard, but is awkward.  
As mentioned in previous replies, use \pdfliteral direct.  
The transformation matrices you will need are described in the PDF Reference Manual.  In the PDFReference13.pdf I have, it's section 4.2.2.  In another version, look up "Transformation Matrices" in the index.  Google "PDF Reference Manual" if you don't have it; free.  
To rotate x degrees, the matrix is    cos x sin x -sin x cos x 0 0 , follow by  cm , for "coordinate matrix."  
To rotate 90 degrees, the text would be \pdfliteral direct{ 0 1 -1 0 0 0 cm }.  Spaces matter.  
Transformation matrices to stretch, skew, and shift are described in the same section of the PDF Reference Manual.
Not hard.  The awkwardness comes in that the rotation is about the lower-left-hand corner of the page, which may rotate your text off the page.  If anyone knows a systematic way to compensate, please post.  I just play with \hskip and \vskip to move it back where I want it.  
More awkwardness comes in that the matrix affects everything after it, and you have to put in another matrix to switch it back, which doesn't always happen cleanly.  
The first time you try it, start with a small transformation.  I suggest this code:

This text is not rotated.  

\pdfliteral direct{ .99619 .08716 -.08716 .99619 0 0 cm } This text is rotated 5 degrees about the lower-left corner of the page. 

\pdfliteral direct{ .99619 -.08716 .08716 .99619 0 0 cm } This text is rotated back 5 degrees and should be aligned with the first sentence.  

Remember that cos(-x) = cos(x) and sin(-x) = -sin(x).  I'm excited to tell my trigonometry class today that I actually used that.  


Brad Burkman

J. Bradford Burkman
Instructor in Mathematics
Louisiana School for Math, Science, and the Arts
Andover Summer Session, Phillips Academy
bburkman at lsmsa.edu

Today's Topics:

   1. text rotation (Bonaventura de'Vidovich)
   2. Re: text rotation (Pawe? Jackowski)
   3. Re: text rotation (Heiko Oberdiek)


Message: 1
Date: Wed, 08 Apr 2009 00:56:44 +0200
From: "Bonaventura de'Vidovich" <ing at bonaventura.com>
Subject: [pdftex] text rotation
To: pdftex at tug.org
Message-ID: <49DBDA2C.4080806 at bonaventura.com>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

I use pdfTeX (TeX not LaTeX).
How can I rotate text?


Message: 2
Date: Wed, 08 Apr 2009 07:15:48 +0200
From: Pawe? Jackowski <P.Jackowski at gust.org.pl>
Subject: Re: [pdftex] text rotation
To: "Bonaventura de'Vidovich" <ing at bonaventura.com>
Cc: pdftex at tug.org
Message-ID: <49DC3304.8060209 at gust.org.pl>
Content-Type: text/plain; charset=UTF-8; format=flowed

Bonaventura de'Vidovich pisze:
> I use pdfTeX (TeX not LaTeX).
> How can I rotate text?

By inserting a transformation matrix into a content stream with 
\pdfliteral, or (if you're using at least pdfTeX 1.4) dedicated 
\pdfsetmatrix command. Some basic example can be found in pdfTeX manual.

Perhaps this can help you


Pawe/l Jackowski
P.Jackowski at gust.org.pl


Message: 3
Date: Wed, 8 Apr 2009 09:35:22 +0200
From: Heiko Oberdiek <oberdiek at uni-freiburg.de>
Subject: Re: [pdftex] text rotation
To: pdftex at tug.org
Message-ID: <20090408073521.GA5934 at irwin.vpn.uni-freiburg.de>
Content-Type: text/plain; charset=us-ascii

On Wed, Apr 08, 2009 at 12:56:44AM +0200, Bonaventura de'Vidovich wrote:

> I use pdfTeX (TeX not LaTeX).
> How can I rotate text?

With the help of miniltx the graphicx package will work, see
graphicx.tex (with \def\Gin at driver{pdftex.def}).

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>


pdftex mailing list
pdftex at tug.org

End of pdftex Digest, Vol 75, Issue 2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4466 bytes
Desc: not available
Url : http://tug.org/pipermail/pdftex/attachments/20090408/ebb202dc/attachment.bin 

More information about the pdftex mailing list