Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want a small amount of information to be placed in columns. The problem is that the information contains paragraphs. Basically this is what I want:

Column 1 Line 1   Column 2 Line 1   Column 3 Line 1
Column 1 Line 2   Column 2 Line 2   Column 3 Line 2
                  Column 2 Line 3

The issue is that all three columns use a different font size, so merely placing each line as a row in a typical \halign doesn't work. Here is my current attempt:

\def\Center#1{\hfil #1 \hfil}
\def\UseFont#1#2{\global\font\currentFont=#1 at #2 \currentFont}
\halign{
    # & # & # \cr
    \Center{Column 1 Line 1}\break\par %neither works
    \Center{Column 1 Line 2}
    &
    \UseFont{cmb10}{18pt}
    \Center{Column 2 Line 1}\break\par
    \Center{Column 2 Line 2}\break\par
    \Center{Column 2 Line 3}\break\par
    &
    \Center{Column 3 Line 1}\break\par
    \Center{Column 3 Line 2}
    \cr
}

The problem with that code is that the newlines don't transfer. I think that the problem is that I am stuck in restricted horizontal mode because of the \halign however if I toss each column into a \vbox the width of the vbox is far too wide and prevents the other columns from showing up.

What can I do to implement this?

share|improve this question
    
use \vbox{\hsize=3cm#} or whatever width you want (which essentially is what latex's p{3cm} column does). –  David Carlisle May 11 at 17:53

1 Answer 1

enter image description here

\long\def\Center#1{\rightskip0pt plus 1fill \leftskip\rightskip \parindent0pt \parfillskip0pt\relax
  #1\par}
\def\UseFont#1#2{\global\font\currentFont=#1 at #2 \currentFont}
\halign{
    \vbox{\hsize3cm#\par} & \vbox{\hsize3cm#\par} & \vbox{\hsize3cm#\par} \cr
    \Center{Column 1 Line 1\par %neither works
    Column 1 Line 2}
    &
    \UseFont{cmb10}{18pt}
    \Center{Column 2 Line 1\par
    Column 2 Line 2\par
    Column 2 Line 3}
    &
    \Center{Column 3 Line 1\par
    Column 3 Line 2}
    \cr
}

\end
share|improve this answer
    
Thank you very much! Quick follow up: your columns are bottom-centered... this is acceptable, but not preferred. Is there a way to make them 'ragged bottom' instead of 'ragged top'? –  LambdaBeta May 11 at 18:35
    
@LambdaBeta use vtop instead of vbox (or far more simply, use a format designed for making documents such as latex or context) –  David Carlisle May 11 at 19:19
    
Thank you very much. As for LaTeX and ConTeXt, I am not a big fan of them. I tend to prefer control over ease of use every time. (its the same reason I prefer C++ over Python and Assembly over C++) –  LambdaBeta May 11 at 20:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.