[Tex/LaTex] Align boxes and rotate boxes in plain TeX

boxescharactersplain-texpositioningrotating

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:

enter image description here

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) ?

Best Answer

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.

enter image description here

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

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

\rotatebox{-45}{Abcdef}
Related Question