將頁面劃分為由上方和下方規則分隔的區域

將頁面劃分為由上方和下方規則分隔的區域

我想將一頁分成多張卡片。每張卡片都是一個矩形,尺寸為文字寬度乘以 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}

在此輸入影像描述

相關內容