5

To make a flexible document structure with bordered tabulars, I want to have uniform heights of specific frames, without specifying the frame height explicitly, because the height is variable. My minimal working example:

\documentclass[10pt,a4paper]{article}
\usepackage[margin=0.4in]{geometry}
\renewcommand{\familydefault}{\sfdefault}
% INPUT
\newcommand\Subject{The subject rule is sometimes one rule and sometimes two rules}
\newcommand\Author{API}
\newcommand\Audience{Stack Exchange}
\newcommand\HeadTitle{This frame is too low!}

\begin{document}
\centering\fbox{ 
\begin{minipage}{\linewidth}
\fbox{
    \begin{minipage}{0.6\linewidth}
        \begin{tabular*}{0.5\linewidth}{r|p{0.75\linewidth}}
                \textbf{Subject:} & \Subject \\
                \textbf{Author:} & \Author \\
                \textbf{Audience:} & \Audience \\
        \end{tabular*}
    \end{minipage}
}
\fbox{
    \begin{minipage}{0.35\linewidth}
        \textbf{\HeadTitle}
    \end{minipage}
}
\end{minipage} }
\end{document}

Giving the following output: enter image description here

1 Answer 1

6

If using an additonal package is an option for you, then tcolorbox could be used for the job.

Here, the two embedded boxes are set by the tcbitemize environment which allows to set the boxes to an equal height. It takes two compilations to see the effect.

For the example, I used a 2mm distance between the two boxes. This distance is put as raster column skip=2mm and is also subtracted from the width of the second box (width=0.4\linewidth-2mm).

\documentclass[10pt,a4paper]{article}
\usepackage[margin=0.4in]{geometry}
\usepackage[raster]{tcolorbox}
\renewcommand{\familydefault}{\sfdefault}
% INPUT
\newcommand\Subject{The subject rule is sometimes one rule and sometimes two rules}
\newcommand\Author{API}
\newcommand\Audience{Stack Exchange}
\newcommand\HeadTitle{This frame is too low!}

\begin{document}
\centering\fbox{
\begin{minipage}{\linewidth}%
\begin{tcbitemize}[size=fbox,sharp corners,
  colframe=black,colback=white,
  raster equal height,raster force size=false,
  raster equal skip=0pt,raster column skip=2mm]
\tcbitem[width=0.6\linewidth]
        \begin{tabular*}{0.5\linewidth}{r|p{0.75\linewidth}}
                \textbf{Subject:} & \Subject \\
                \textbf{Author:} & \Author \\
                \textbf{Audience:} & \Audience \\
        \end{tabular*}
\tcbitem[width=0.4\linewidth-2mm]
        \textbf{\HeadTitle}
\end{tcbitemize}%
\end{minipage} }
\end{document}

enter image description here

2
  • this works and I think this is an elegant solution Oct 23, 2015 at 9:10
  • @API I'm glad that this was helpful :-) Oct 23, 2015 at 9:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .