Using vertical line column separator in tabular between JUST TWO cells

For example

\documentclass[11pt]{book}
\usepackage{color}
\usepackage{multirow}
\begin{document}
\begin{center}
\begin{tabular}{c@{} c@{} c@{} c@{} c@{} c@{} c@{} c@{} c@{} c@{} c@{} c@{}}
%\multirow{2}{*}{$-$}&1&5&7&{\huge,}&5&&&5&{\color{white}1}&{\color{white}1}&    {\color{white}1}\\
\multirow{2}{*}{$-$}&1&5&7&{\huge,}&5&&&\vline\,5&{\color{white}1}&{\color{white}1}&    {\color{white}1}\\
\cline{9-12}
&1&5&&&&{\color{white}1}&{\color{white}1}&3&1&&\\
\cline{2-6}
\multirow{2}{*}{$-$}&&&7&&&&&&&&\\
&&&5&&&&&&&&\\
\cline{2-6}
&&&2&&&&&&&&\\
\end{tabular}
\end{center}
\end{document}

enter image description here


Here's an approach that doesn't use tabular but instead stacking. \vst is the vertical strut you sought, while \bvst is a blank placeholder that takes the identical horizontal space. \pul is the underlining mechanism and \hc is your huge comma.

\documentclass[11pt]{book}
\usepackage{stackengine}
\begin{document}
{\centering
\def\hc{{\Huge,}}
\def\pul{\protect\underline}
\def\vst{\protect\smash{\rule[-1.8pt]{.1ex}{2.5ex}\protect\rule{.4ex}{0ex}}}
\def\bvst{\protect\rule{.5ex}{0ex}}
\Longunderstack[l]{\pul{~~}157\hc5 ~~\pul{15~~~~~} %
  \underline{~~}~~~7 %
   ~~\underline{~~~5~~~~} ~~~~~2}
\Longunderstack[l]{\underline{\vst5~~~~} \bvst31}\par}
\end{document}

enter image description here

With the next release of stackengine in a few days, you won't need to \protect the arguments to \Longunderstack, thanks to help from egreg.


This doesn't answer your question but... why don't you take a look at the xlop package?

Example

\documentclass[11pt]{book}
\usepackage{xlop}

\begin{document}

\opdiv[shiftdecimalsep=none,displayintermediary=nonzero]{157.5}{5}

\end{document} 

Output

enter image description here

Tags:

Rules

Tables