tcolorbox:將高度四捨五入到給定尺寸的下一個倍數

tcolorbox:將高度四捨五入到給定尺寸的下一個倍數

我已經開始使用這個非常強大的包了tcolorbox。我想要實現的一件事是為學校練習表製作一個網格。我想快到了。但最好創建一個盒子,其高度按以下方式計​​算。

應計算可用內容的盒子的自然高度。然後,該尺寸應向上捨入為給定長度的下一個整數倍。然後盒子的高度應該會設定為該結果。

這個想法是網格在頂部和底部看起來是對稱的。

這是我到目前為止所擁有的:

\documentclass{article}

\usepackage[most]{tcolorbox}
\usetikzlibrary{calc}

\newtcolorbox{mygrid}{breakable, colback=white, enhanced, 
    boxrule=0pt, arc=0pt, outer arc=0pt,
    boxsep=0pt, top=9pt, left=13pt, right=13pt, bottom=10pt,
    underlay={\begin{tcbclipinterior}
        \filldraw[help lines, black!15, step=0.04\linewidth,
                shift={($0.5*(interior.north west)+0.5*(interior.north east)
                    -0.02*(0,\linewidth)$)}]
            (interior.south west) grid (interior.north east);
        \end{tcbclipinterior}}}

\begin{document}
\begin{mygrid}
Some content. Some content. Some content. Some content. Some content. Some content. 
Some content. Some content. Some content. Some content. Some content. Some content. 
Some content. Some content. Some content. Some content. Some content. Some content. 
Some content. Some content. Some content. Some content. Some content.  
\end{mygrid}
\end{document}

這可能嗎?

相關內容