Rotating text (byline) 

Newsgroups:  comp.text.tex
Date:        Tue, 23 Mar 2004 12:55:49 -0800

Martin Magnusson wrote:

> Sorry, I found the rotating package. That should do what I want, I suppose.

The \rotatebox command of the graphics package (or the graphicx package) should also do what you want, I think.

Brooks

rotate text in LaTeX 

Newsgroups: comp.text.tex
Date: 1992-02-06 09:21:28 PST
Does anyone know of a way to produce rotated text in LaTeX?  I am
drawing pictures using the picture environment and would like to
create labels using text rotated 90 degrees counterclockwise instead
of using \shortstack.

its easy enuf, if you use a PostScript printer. my `rotating.sty' LaTeX style option implements it all for you, but only works with a PS printer and either dvips or dvitops (what else would one use :-}?).

all in [tex-archive.latex.contrib.rotating] in the UK TeX Archive

sebastian rahtz

Vertical text in LaTeX 

Newsgroups: comp.graphics.apps.gnuplot
Date: 1997/04/10
> > does anybody know if there is possibility to have vertically labeled
> > y-axes in LaTeX plots without using postscript? I tried
> > "set terminal mf", but macro "put_text" in the source "mf" file had
> > not worked and result was plot without text at all. Seems like a bug.
>
>There is no possibility to get vertical text in LaTeX without using
>Postscript, sorry.

This answer is a bit misleading. Perhaps it should have been stated as

"There is no way to make gnuplot produce vertically labeled
 axes without using gnuplot's PostScript terminal."

The graphicx package (distributed with LaTeX) has a \rotatebox command which rotates text, graphics, etc to any angle. Not all DVI drivers support rotated text, but \rotatebox will work on any that does.

Keith

vertical y-axis label in latex 

Newsgroups: comp.graphics.gnuplot, comp.text.tex
Date: 1994-05-03 13:47:22 PST
> I need to include plots in a latex file and am trying gnuplot.  I
> tried many variations and eventually decided that the eepic output
> of gnuplot look aceptably good, apart from one teensy little
> problem that was not addressed in the Latex Companion or the
> gnuplot FAQ, and that is writing the y axis label vertically.
> Latex and eepic write it horizontally accross the graph.  On xfig
> it appears correctly, but a latex or eepic export from xfig again
> messes it up.

The problem is that LaTeX (and in general TeX) doesn't do rotated text like you want. It is not a supported feature of the program. Since you mention that you use rotating.sty, you imply that you have a PostScript printer. The text rotating is done via PostScript trickery when the file is converted from a DVI file into a PostScript file. Your best bet in this case, is to use the pslatex terminal for gnuplot. It produces the best looking graphics, with the advantage of the nice LaTeX text (including the ability to do math-mode superscripts, greek, etc.)

As an aside, the text appeared properly in xfig since xfig supports rotated text. When you re-exported back to eepic or latex, it can't support it so xfig does the best it can in that case.

Vivek Khera

How to rotate tables in latex? 

Newsgroups: comp.text.tex
Date: 1991-10-14 16:26:26 PST

Recently, somebody posted a rotate style file. I've tried to use it on a table, with the following lines in the latex file:

% sideways is one of the environments defined in the style file.
\begin{sideways}
\begin{table}[hp]
\caption{Symmetry Operations of the Point Group $T_d$
of the Zincblende Lattice.}
\label{t:zb-pg}
\vspace{0.2in}
\centering
\begin{tabular}{|c|c|c|} \hline\hline
...... % here's the actual table

I got the following:

LaTeX error.  See LaTeX manual for explanation.
              Type  H <return>  for immediate help.
! Not in outer par mode.
\@latexerr ...for immediate help.}\errmessage {#1}
\@xfloat ...ef \@captype {#1}\ifinner \@parmoderr
                                                  \@floatpenalty \z@ \else \...
l.80 \begin{table}[hp]

Can anybody explain to me what's going on, and if one is not allowed to use a table environment inside the sideways one, how could i get to rotate a table?

the style file i used started with the following lines:

%% LaTeX Macros for PostScript rotation of text
%% Sebastian Rahtz, Dept. of Computer Science, Southampton University
%% Paul Barton-Davis, Dept. of Computer Science, University of Washington
%% 10-sep-91 pad -      added code supplied by Peter Bloomfield from
%%                      Tom Rockiki's dvips to eliminate dependence
%%                      on the prologue.
%%
%% 13-Mar-89 pad -  ...

How to rotate tables in latex? 

> how could i get to rotate a table?

You want to rotate the contents of the `table' environment (i.e., the caption, tabular, etc.). To do this you should better write

\begin{table}[hp]
\begin{sideways}
% etc.
\end{sideways}
\end{table}

bernd

How to rotate text in LaTex ? 

Newsgroups: comp.text.tex
Date: 1993-10-01 01:20:37 PST
> How do I rotate text in LaTex ?

get rotate.sty - here it is anyway…

%
%   These macros allow you to rotate or flip a \TeX\ box.  Very useful for
%   sideways tables or upsidedown answers.
%
%   To use, create a box containing the information you want to rotate.
%   (An hbox or vbox will do.)  Now call \@rotr\boxnum to rotate the
%   material and create a new box with the appropriate (flipped) dimensions.
%   \@rotr rotates right, \@rotl rotates left, \@rotu turns upside down, and
%   \@rotf flips.  These boxes may contain other rotated boxes.
%
\newdimen\@rotdimen
\newbox\@rotbox

\def\@vspec#1{\special{ps:#1}}%  passes #1 verbatim to the output
\def\@rotstart#1{\@vspec{gsave currentpoint currentpoint translate
   #1 neg exch neg exch translate}}% #1 can be any origin-fixing transformation
\def\@rotfinish{\@vspec{currentpoint grestore moveto}}% gets back in synch
%
%   First, the rotation right. The reference point of the rotated box
%   is the lower right corner of the original box.
%
\def\@rotr#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
   \hbox to\@rotdimen{\hskip\ht#1\vbox to\wd#1{\@rotstart{90 rotate}%
   \box#1\vss}\hss}\@rotfinish}
%
%   Next, the rotation left. The reference point of the rotated box
%   is the upper left corner of the original box.
%
\def\@rotl#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
   \hbox to\@rotdimen{\vbox to\wd#1{\vskip\wd#1\@rotstart{270 rotate}%
   \box#1\vss}\hss}\@rotfinish}%
%
%   Upside down is simple. The reference point of the rotated box
%   is the upper right corner of the original box. (The box's height
%   should be the current font's xheight, \fontdimen5\font,
%   if you want that xheight to be at the baseline after rotation.)
%
\def\@rotu#1{\@rotdimen=\ht#1\advance\@rotdimen by\dp#1%
   \hbox to\wd#1{\hskip\wd#1\vbox to\@rotdimen{\vskip\@rotdimen
   \@rotstart{-1 dup scale}\box#1\vss}\hss}\@rotfinish}%
%
%   And flipped end for end is pretty ysae too. We retain the baseline.
%
\def\@rotf#1{\hbox to\wd#1{\hskip\wd#1\@rotstart{-1 1 scale}%
   \box#1\hss}\@rotfinish}%
%
%   Now the user interface for LaTeX:  \rotate[type]{text} where
%   ``type'' is `l' for left, `r' for right, `u' for upside-down, or
%   `f' for flip.  `l' is the default.
%
\def\rotate{\@ifnextchar[{\@rotate}{\@rotate[l]}}
\def\@rotate[#1]#2{\setbox\@rotbox=\hbox{#2}\@nameuse{@rot#1}\@rotbox}

Vincent White

rotate.sty in LaTeX (a "new" version is included) 

Newsgroups: comp.text.tex
Date: 1991-09-10 01:23:11 PST
> [ ... stuff about \rotate ... ]

I don't understand what this apparently rather limited rotate.sty file is. The one I use (enclosed below) handles specific rotation back and forth, as well as two differing environments, one in which the new size is used to specify the containing box (turn), and one in which it isn't (rotate) (i.e. one in which space is cleared for the rotated stuff, and one in which it is not, and the surrounding text assumes no rotation has taken place). Apologies if I'm misunderstanding the issues or the versions.

Usage:

\begin{turn}{-34}
...
\end{turn}

will turn … through 34 degrees anticlockwise.

The version below was obtained, as indicated, from Sebastian, who was using it with some forgotten dvi->ps translator. It wouldn't work for me until I hacked dvi2ps to have a qualifier on the pstext keyword to say "don't wrap this up in save/restore pairs". From what I've seen since, most current dvi->ps programs have such a facility. You'll need to use it to get this to work, but then its very, very, very nice. I use it all the time to put sloping column names on tables, and to play silly games with arbitrarily rotated letters making up the same word.

You'll also need the PostScript definition of /newram. I don't have this right now, and its hard to find (offline on some tapes). Maybe Sebastian could post this if he's listening in … otherwise, I'll dig it up RSN.

paul

%% LaTeX Macros for PostScript rotation of text
%% Sebastian Rahtz, Dept. of Computer Science, Southampton University
%%

%% 13-Mar-89 pad -  added "global" keyword to \special to stop
%%   dvi2ps from wrapping the rotated text
%%   up in @begin-, @start- and @endspecials.

%% these use the PostScript function /newram, defined in the PS header
%% file.

% environments to print text sideways

[...]

rotate.sty - a working version enclosed 

View this article only Newsgroups: comp.text.tex Date: 1991-09-10 15:00:55 PST

Enclosed below, thanks to Peter Bloomfield, is a modified version of the rotate.sty that I posted yesterday. This one has no dependence on any prologue file, but instead uses the capabilities of various DVI to PostScript drivers to output PostScript verbatim. See the comments for more details. Also, please read the notes on the difference between the turn and the rotate environments.

-- paul
%% LaTeX Macros for PostScript rotation of text
%% Sebastian Rahtz, Dept. of Computer Science, Southampton University
%% Paul Barton-Davis, Dept. of Computer Science, University of Washington

%% 10-sep-91 pad -      added code supplied by Peter Bloomfield from
%%                      Tom Rockiki's dvips to eliminate dependence
%%                      on the prologue.
%%
%% 13-Mar-89 pad -  added "global" keyword to \special to stop
%%   dvi2ps from wrapping the rotated text
%%   up in @begin-, @start- and @endspecials.

%% \@verbps{TEXT} outputs TEXT directly to the DVI file, with no
%% surrounding context. Following are 3 definitions for 3 different
%% DVI->PostScript drivers. The key part of these is that the
%% \special's argument must NOT be enclosed in any context saving
%% mechanism. Each driver has a different method for specifying this.
%%
%% For Rockiki's dvips
%%
%\def\@verbps#1{\special{ps:#1}}
%%
%% For a modified dvi2ps that has the "global" modifier for pstext
%%
%\def\@verbps#1{\special{global pstext="#1"}}
%%
%% For Bechtolstein's dvitps
%%
\def\@verbps#1{\special{dvitps: Literal "#1"}}
%%
%% The box we put rotated text into
%%
\newsavebox{\swbox}\newlength{\spht}\newlength{\spwd}
%%
%% \begin{rotate}{DEGREES}
%% TEXT
%% \end{rotate}
%%
%% rotates TEXT by DEGREES, but puts TEXT into a box with zero size.
%%      Use this for special effects. The "turn" environment, below,
%%      is probably closer to what you want for normal rotation,
%%      because it calculates the correct box size.

\newenvironment{rotate}[1]{\def\rotangle{#1}\savebox{\swbox}\bgroup}{%
 \egroup
 \global\spwd=\dp\swbox
 \global\advance\spwd by \ht\swbox
 \global\spht=\wd\swbox%
 %% do the PostScript magic
 \@verbps{gsave currentpoint currentpoint translate
\rotangle\space rotate neg exch neg exch translate}%
 \dp\swbox=0pt\wd\swbox=0pt\ht\swbox=0pt%
 \usebox{\swbox}
 %% End the PostScript magic
 \@verbps{grestore}
}
%
% macros to calculate sines from 90 to -90
% Jim Walker,  Dept Mathematics,  University of South Carolina
%
\newdimen\x
\newdimen\y
\newdimen\xsquare
\newdimen\xfourth
{%
\catcode`\p=12
\catcode`\t=12
\gdef\numonly#1pt{%
\def\xx{#1}%
}%
}%
\def\MULTyBYx{%
\expandafter\numonly\the\x
\edef\b{\y=\xx\y}%
\b
}%
\def\calcsin{% Find sin(\x) and put it in \y. Say \x is in degrees.
\x=0.0174533\x % Convert to radians.
\y=\x
\MULTyBYx
\xsquare=\y
\MULTyBYx
\MULTyBYx
\xfourth=\y
\y=1pt
\advance\y by -0.1666666\xsquare
\advance\y by 0.008333333\xfourth
\MULTyBYx
}%
%
% Example of use:
%\x=23pt \calcsin \expandafter\numonly\the\y
% Now \xx should contain the sine of 23 degrees.
%
% given a box with width W and height H,  then its height after rotation by R
% is W * sin(R) + H * cos(R),  and it extends W * cos(R) to the right
% and H * sin(R) to the left
% (arithmetic courtesy of Nico Poppelier)
%
\newdimen\xh\newdimen\xw\newdimen\xtemp\newdimen\xcos\newdimen\xsin
\newdimen\xleft\newdimen\xright
\def\MULTxtempBYxcos{\expandafter\numonly\the\xcos\edef\b{\xtemp=\xx\xtemp}\b}%
\def\MULTxtempBYxsin{\expandafter\numonly\the\xsin\edef\b{\xtemp=\xx\xtemp}\b}%
%%
%%
%% \begin{turn}{DEGREES}
%% TEXT
%% \end{turn}
%%
%%     rotates TEXT by DEGREES, and puts into a box corresponding to
%%     the size of the rotated material. Use this to rotate text when
%%     you want the surrounding material to take account of the rotation.

\newenvironment{turn}[1]{\def\rotangle{#1}\savebox{\swbox}\bgroup}{%
 \egroup
 \global\spht=\dp\swbox
 \global\advance\spht by \ht\swbox
 \global\spwd=\wd\swbox%
 \xtemp=\rotangle pt % convert rotation to dimension
 \multiply\xtemp by -1
 \x=\xtemp\calcsin\xsin=\y
 \multiply\xtemp by -1\advance\xtemp by 90pt\x=\xtemp\calcsin\xcos=\y
 % \xsin =sin (R) and \xcos = cos(R)
 \xtemp=\spwd\MULTxtempBYxsin\xh=\xtemp
 \xtemp=\spht\MULTxtempBYxcos\advance\xh by \xtemp %\xh contains the height
 \xtemp=\spht\MULTxtempBYxsin\xleft=\xtemp
 \xtemp\spwd\MULTxtempBYxcos\xright=\xtemp % \xleft and \right are offsets
 \rule{\xleft}{0pt}%
 %% do the PostScript magic
 \@verbps{gsave currentpoint currentpoint translate
\rotangle\space rotate neg exch neg exch translate}%
 \dp\swbox=0pt\wd\swbox=0pt\ht\swbox=0pt%
 \rlap{\usebox{\swbox}}%
 \@verbps{grestore}
 \rlap{\rule{0pt}{\xh}}\rule{\xright}{0pt}%
}
%%
%%  Print it sideways
%%
\newenvironment{sideways}{\begin{turn}{-90}}{\end{turn}}

Paul Barton-Davis

rotate.sty - a working version enclosed 

NB, the latest version of rotating.sty in systems/mac/textures/latex/latex2e <http://www.ctan.org/tex-archive/systems/mac/textures/latex/latex2e/> is Nov 18, 1999, which is newer than Paul's hack.