陰影多色 II

陰影多色 II

在擴展之前的問題時,陰影多色,如何在 multicol 環境中為外部 4 個角(即緊鄰頁邊距的角)放置圓角

這個問題只有在使用多色著色或使用多色邊框時才真正相關,這是該問題第一部分中包含的解決方案(請參閱上面的連結)。

最主要的是環境需要能夠在中途進行分頁。大衛·卡萊爾(David Carlisle)在其中一條評論中建議修補框命令,但是如何才能做到只圓化左列的左兩個角,右列的右兩個角,並且中間列沒有角(當有3 列或更多列時)。

答案1

在此輸入影像描述

正如問題中所指出的,這本質上只是替換\fcolorboxmdframed(感謝 Marco 提供了正確的mdframed咒語)

\documentclass{article}
\usepackage{multicol}
\usepackage[framemethod=tikz]{mdframed}

\makeatletter
\let\old@page@sofar\page@sofar
\let\old@box\box
\let\old@rlap\rlap
\def\page@sofar{%
\let\box\colorcolumn
\def\rlap{\let\box\old@box\old@rlap}%
\old@page@sofar
}
\def\colorcolumn#1{%
\ifnum#1=\mult@rightbox
\def\zz{\begin{mdframed}[middlelinewidth=2pt,roundcorner=5pt,leftline=false,backgroundcolor=yellow]}%
\fi
\ifnum#1=\numexpr\mult@rightbox+2\relax
 \def\zz{\begin{mdframed}[middlelinewidth=2pt,roundcorner=5pt,rightline=false,backgroundcolor=yellow]}%
\fi
\ifnum#1=\numexpr\mult@rightbox+4\relax
  \def\zz{\begin{mdframed}[middlelinewidth=2pt,roundcorner=5pt,rightline=false,leftline=false,backgroundcolor=yellow]}%
\fi
       \kern\dimexpr-15pt\relax
        {\let\box\old@box\vtop{%
          \zz{%
           \hbox{\box#1\llap{\phantom p}}}%
           \end{mdframed}}}%
        \kern\dimexpr-15pt\relax
}

\makeatother


\def\a{Red blue green yellow black white. }
\def\b{One two three four five six. }
\def\c{\stepcounter{enumi} \Roman{enumi}
\a\a\b\b\a\a\b\a\a\b\b\b\b\b\b\a\a\b}
\begin{document}

\begin{multicols}{3}
\c\c\c\c\c\c\c\c\c\c
\end{multicols}

\end{document}

相關內容