如何自定义 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}

在此处输入图片描述

相关内容