3

I want the two lower boxes to butt up directly against (in fact overlap exactly) with the upper box. I tried \raisebox but this didn't do the right thing. \offinterlineskip almost does the right job, but I would like the upper border of the lower box to sit on top of the lower border of the upper box. I tried a negative vspace but this did nothing.

the MWE is:

\documentclass[12pt]{article}
\setlength{\parindent}{0ex}
\setlength{\parskip}{0ex}
\begin{document}
\huge
\fboxsep=0pt
\fboxrule=0.5pt
% \vspace*{-1pt}
% \offinterlineskip
\framebox{\parbox[b][2cm][c]{5cm}{\hfill6\hspace*{\fill}}}\\
\framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm-\fboxrule)\relax}{\hfill4\hspace*{\fill}}}%
\hspace{-\fboxrule}%
\framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm)\relax}{\hfill2\hspace*{\fill}}}
\end{document}
5
  • To overlap, use \lineskip=-0.5pt, but put it in a group so that it will revert to normal when done. – John Kormylo Oct 18 '17 at 15:05
  • I tried this, but doesn't raise the box. It seems not to make any difference. – Tim Oct 18 '17 at 15:18
  • Are you using \offinterlineskip? That turns off \lineskip. – John Kormylo Oct 18 '17 at 15:21
  • no, i'm not using \offinterlineskip. just inserted \lineskip=-0.5pt within group containing the \frameboxes – Tim Oct 18 '17 at 16:22
  • Oops! For some reason it has to be set globally. Probably because the code which uses it is higher that the code which sets it. – John Kormylo Oct 18 '17 at 16:42
3

Wouldn't a stack be easier? That way, all the \parskip/\vspace/interlineskip stuff is moot.

\documentclass[12pt]{article}
\usepackage{stackengine}
\begin{document}
\huge
\fboxsep=0pt
\fboxrule=0.5pt
\stackunder[-\fboxrule]{%
  \framebox{\parbox[b][2cm][c]{5cm}{\hfill6\hspace*{\fill}}}%
}{%
  \framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm-\fboxrule)\relax}{\hfill4\hspace*{\fill}}}%
  \hspace{-\fboxrule}%
  \framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm)\relax}{\hfill2\hspace*{\fill}}}%
}
\end{document}

enter image description here

2
  • I had never heard of this package before. But it does the trick and more. – Tim Oct 18 '17 at 18:32
  • @Tim Thanks. And if you need to do stacks that are tabbed, look up the tabstackengine package that extends it. – Steven B. Segletes Oct 18 '17 at 18:51
2

You can use a minipage to save and restore \lineskip.

\documentclass[12pt]{article}
\setlength{\parindent}{0ex}
\setlength{\parskip}{0ex}
\begin{document}
\begin{minipage}{\textwidth}
\huge
\fboxsep=0pt
\fboxrule=0.5pt
\lineskip=-0.5pt
% \vspace*{-1pt}
% \offinterlineskip
\framebox{\parbox[b][2cm][c]{5cm}{\hfill6\hspace*{\fill}}}\\
\framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm-\fboxrule)\relax}{\hfill4\hspace*{\fill}}}%
\hspace{-\fboxrule}%
\framebox{\parbox[b][2cm][c]{\dimexpr(2.5cm)\relax}{\hfill2\hspace*{\fill}}}%
\end{minipage}
\the\lineskip
\end{document}

demo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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