将页面划分为上下按规则分隔的区域

将页面划分为上下按规则分隔的区域

我想将一页分成多张卡片。每张卡片都是一个矩形,大小为文本宽度乘以 5 厘米。每张卡片的两边都应有规则。这意味着页面上的第一张卡片顶部应有规则,页面上的最后一张卡片底部应有规则,相邻的卡片之间应有一条规则。规则用于将页面物理地切割成卡片,所有卡片应具有相同的大小。

我可以使用 minipage 创建卡片。但是,如果我在卡片底部放置规则,页面上的第一张卡片顶部缺少规则。如果我在卡片的两侧都有规则,那么卡片之间的规则就会加倍。

答案1

我建议tcbraster从 中tcolorbox应用高度可配置的环境raster equal height

cardbox环境用于显示栅格项并且可以包含“任何内容”。

请编译两次以获得正确的高度。

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage[a4paper,margin=0.5cm]{geometry}

\newtcolorbox{cardbox}[1][]{%
  colback=white,
  enhanced jigsaw,
  sharp corners,
  width=5cm,
  #1,
}

\usepackage{blindtext}



\begin{document}

\begin{tcbraster}[raster columns=4,raster equal height,boxrule=1pt, raster column skip=2pt, raster row skip=2pt]
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo bar
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}[colback=yellow]
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}
  \begin{cardbox}
    Foo
  \end{cardbox}

\end{tcbraster}

\end{document}

在此处输入图片描述

相关内容