Plain TeX simple horizontal alignment in table

horizontal alignmentplain-tex

Beginner's question: Why doesn't horizontal alignment work as I expect in this simple table?
I just have a set of variables with values in the left column which I want to align under the heading "Givet"(=Given) and a set of variables which are sought in the right column which I want to align under the heading "Sökt".
It either complains that I should use "math accents in math mode" or it complains that I am missing a # or a &.

\halign{       #&#&#                & \quad\hfil    #&#                 \cr
\it{Givet}\rm   &{}&{}              &               {}&\it{S\"okt}\rm   \cr
$\varphi_{m}$   &=&0.4              &               {}&$\dot{V_{o}}$    \cr
$t_{m}$         &=&$21^{\rm{o}}$C   &               {}&$\Delta i_{o}$   \cr
$t_{o}$         &=&$0^{\rm{o}}$C    &               {}&$\t_{o}'$        \cr
$\varphi_{o}$   &=&0.7              &               {}&{}               \cr
$t_{2}$         &=&$24^{\rm{o}}$C   &               {}&{}               \cr
$\varphi_{2}$   &=&0.5              &               {}&{}               \cr
p               &=&1.013 bar        &               {}&{}               \cr

}

Best Answer

I think you want something like

enter image description here

\halign{\hfil#\unskip&${}#{}$&#\unskip\hfil   & \quad\hfil    #&#\unskip\hfil   \cr
\multispan{2}{\it Givet}&{}              &               {}&\it S\"okt   \cr
$\varphi_{m}$   &=&0.4              &               {}&$\dot{V_{o}}$    \cr
$t_{m}$         &=&$21^{\rm o}$C   &               {}&$\Delta i_{o}$   \cr
$t_{o}$         &=&$0^{\rm o}$C    &               {}&$t_{o}'$        \cr
$\varphi_{o}$   &=&0.7              &               {}&{}               \cr
$t_{2}$         &=&$24^{\rm o}$C   &               {}&{}               \cr
$\varphi_{2}$   &=&0.5              &               {}&{}               \cr
p               &=&1.013 bar        &               {}&{}               \cr
}


\bigskip

\halign{#\unskip\hfil&${}#{}$&#\hfil                & \quad\hfil    #&#\hfil    \cr
\multispan{2}{\it Givet}&{}              &               {}&\it S\"okt   \cr
$\varphi_{m}$   &=&0.4              &               {}&$\dot{V_{o}}$    \cr
$t_{m}$         &=&$21^{\rm o}$C   &               {}&$\Delta i_{o}$   \cr
$t_{o}$         &=&$0^{\rm o}$C    &               {}&$t_{o}'$        \cr
$\varphi_{o}$   &=&0.7              &               {}&{}               \cr
$t_{2}$         &=&$24^{\rm o}$C   &               {}&{}               \cr
$\varphi_{2}$   &=&0.5              &               {}&{}               \cr
p               &=&1.013 bar        &               {}&{}               \cr
}

\bigskip

\halign{#\unskip\hfil                & \quad\hfil    #&#\unskip\hfil      \cr
\it Givet               &               {}&\it S\"okt   \cr
$\varphi_{m}   =0.4 $             &               {}&$\dot{V_{o}}$    \cr
$t_{m}         =21^{\rm o}{\rm C}$   &               {}&$\Delta i_{o}$   \cr
$t_{o}        =0^{\rm o}{\rm C}$    &               {}&$t_{o}'$        \cr
$\varphi_{o}   =0.7    $          &               {}&{}               \cr
$t_{2}       =24^{\rm o}{\rm C}$   &               {}&{}               \cr
$\varphi_{2}   =0.5$              &               {}&{}               \cr
${\rm p}               =1.013 \,{\rm bar}$        &               {}&{}               \cr
}

\bye

Note I added glue to all columns to give alignment, forced math spacing for =, and \rm and \it do not take an argument so I removed the { } brace groups.

The error about accents is due to \t which I think is just a typo for t here so I changed it to that.