如何自訂 tcolorbox 柵格中的框方向?

如何自訂 tcolorbox 柵格中的框方向?

我正在使用rasteroftcolorbox為我的考試製作公式表。問題是我的母語(希伯來語)是 RTL 語言。因此,我希望盒子從右到左排列。我嘗試在網上搜索,但找不到如何做到這一點。例如:

% In preamble
\newtcolorbox{cheat}[1]{
    colback=black!5!white,
    colframe=black,
    colbacktitle=black,
    fonttitle=\bfseries,
    enhanced,
    attach boxed title to top right={xshift=-2mm, yshift=-2mm},
    title={#1}
}

% In document
\begin{tcbraster}[raster columns=3]

\begin{cheat}{Heating Problem}
    $\frac{dT}{dt} = -k(T-T_o)$ \\
    $ T_o =$ outside temperature
\end{cheat}

\begin{cheat}{Mixing Problem}
    $\frac{dA}{dt} = c_1r_1-\frac{A}{V}r_2$\\
    $V=V_0 +(r_1 - r_2)t$ \\
    $c_1$, solution mixture in \\
    $r_1$, in rate \\
    $r_2$, out rate
\end{cheat}

\end{tcbraster}

想像一下這些公式是從右向左書寫的,因此將框放在右側更有意義。

有誰知道如何配置它以從右到左、從上到下的方式排列框框?

答案1

似乎在柵格中的 es\par之間添加空白行 (a )會導致換行。\tcolorbox因此,請避免在框之間放置空白行以使它們彼此相鄰:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{raster,skins}

\newtcolorbox{cheat}[1]{
    colback=black!5!white,
    colframe=black,
    colbacktitle=black,
    fonttitle=\bfseries,
    enhanced,
    attach boxed title to top right={xshift=-2mm, yshift=-2mm},
    title={#1}
}

\begin{document}

% With line break
\begin{tcbraster}[raster columns=3]

\begin{cheat}{Heating Problem}
    $\frac{dT}{dt} = -k(T-T_o)$ \\
    $ T_o =$ outside temperature
\end{cheat}

\begin{cheat}{Mixing Problem}
    $\frac{dA}{dt} = c_1r_1-\frac{A}{V}r_2$\\
    $V=V_0 +(r_1 - r_2)t$ \\
    $c_1$, solution mixture in \\
    $r_1$, in rate \\
    $r_2$, out rate
\end{cheat}

\end{tcbraster}

% Without line break
\begin{tcbraster}[raster columns=3]
\begin{cheat}{Heating Problem}
    $\frac{dT}{dt} = -k(T-T_o)$ \\
    $ T_o =$ outside temperature
\end{cheat}
\begin{cheat}{Mixing Problem}
    $\frac{dA}{dt} = c_1r_1-\frac{A}{V}r_2$\\
    $V=V_0 +(r_1 - r_2)t$ \\
    $c_1$, solution mixture in \\
    $r_1$, in rate \\
    $r_2$, out rate
\end{cheat}
\end{tcbraster}

\end{document}

在此輸入影像描述

相關內容