为了制作具有边框表格的灵活文档结构,我希望特定框架的高度统一,而无需明确指定框架高度,因为高度是可变的。我的最小工作示例:
\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}
答案1
如果使用附加包对您来说是一种选择,那么它tcolorbox
可以用于这项工作。
这里,两个嵌入的框由tcbitemize
环境设置,允许将框设置为相等的高度。需要编译两次才能看到效果。
举个例子,我使用了2mm
两个框之间的距离。这个距离被当作raster column skip=2mm
并从第二个框的宽度中减去(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}