# Align boxes and rotate boxes in plain TeX

When I finish reading the Appendix D: Dirty Tricks in the TeXbook, I rethink a question: is it possible to align some character boxes like this:

The input may be like this:

    \font\fortyeightrm=cmr10 at48pt
\font\twentyfourrm=cmr10 at24pt

\parindent=0pt
{\fortyeightrm A}|\twentyfourrm a b c d e f g h i j k l m n o p q r|
\bye


We assume that when TeX is scanning the big A, it will place that character box at the baseline of the first line. When scanning the |, it will enter a group, then TeX will place the character boxes a, b, c, ... , r above then below the axis of the character box A (at this time, TeX may be insert the line-break at the end of a line, for example, behind the character box i)

I haven't a good and simple method to solve this. Also another question: is it possible to rotate the character box (maybe we should put it into a \hbox) ?

-
Using (x)dvipdfm(x) (i.e., XeTeX) driver, the rotation could be: before \special{pdf: begintransform rotate 35 } rotated \special{pdf: endtransform} after\bye. But you're right, the content shouldn't be broken across pages according to the dvipdfm manual. –  morbusg Mar 29 '13 at 9:05

Using 48pt and 24pt fonts is not a good idea, because the relevant dimension is the height of capitals. So the big letter should be in a larger size, in my opinion.

\font\highcapital=cmr10 at60pt
\font\twentyfourrm=cmr10 at24pt

\def\timlititle#1#2{%
\hbox{%
\setbox0=\hbox{\highcapital #1}%
\dimen0=\ht0
\box0\vbox to\dimen0{
\twentyfourrm
\def\\{\egroup\nointerlineskip\vss\hbox\bgroup\ignorespaces}%
\hbox\bgroup#2\egroup}%
}%
}

\hrule
\timlititle{A}
{a b c d e f g h i \\
j k l m n o p q r}

\bigskip

\font\highcapital=cmr10 at54pt

\hrule
\timlititle{A}
{a b c d e f g h i \\
j k l m n o p q r}

\bigskip

\font\highcapital=cmr10 at48pt

\hrule
\timlititle{A}
{a b c d e f g h i \\
j k l m n o p q r}

\bye


The \hrule commands are just to show the vertical alignment of the boxes. In Computer Modern, the "A" has quite a big overshoot at the top, so you may want to add a small correction for the right box height.

For rotating boxes, you can use eplain's facilities to load the LaTeX graphicx package:

\input eplain
\beginpackages
\usepackage{graphicx}
\endpackages

\rotatebox{-45}{Abcdef}

-
yeah, the first of the three examples is more pleasing to the eyes. Thanks, egreg. –  Timothy Li Mar 29 '13 at 0:28

    \font\fortyeightrm=cmr10 at48pt
\font\twentyfourrm=cmr10 at24pt

\hsize 3in

\def\foo#1|#2|{%
\setbox0\hbox{#1}%
\dimen0\ht0
\divide\dimen0 2

\parindent=0pt

X\dotfill X

\bigskip

\foo
{\fortyeightrm A}|\twentyfourrm a b c d e f g h i j k l m n o p q r|

\bigskip

X\dotfill X
\bye

-
Wonderful! I think this method is simple and elegant to solve my question :-) –  Timothy Li Mar 28 '13 at 14:12