使用 boiboites 风格的方框来拆分页面

使用 boiboites 风格的方框来拆分页面

我想找到一种方法来打破我环境示例的框(阿拉伯语,多语种……参见下面的 ECM)我看到 mdframed 做了类似的事情,但我使用我自己的包“myboiboites”从 boiboites 中衍生出来,用于阿拉伯化。我发布了文件和包……文件为阿拉伯语……你可以看到它有 2 个非常“糟糕的页面”,因为框示例拒绝在半页中写入……

\documentclass[14pt,a4paper]{extbook}
%\usepackage{extsizes}




\usepackage[dvips]{graphicx}
\usepackage{boxedminipage}
\usepackage{slashbox} 


\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{framed}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{enumitem}

\usepackage{minitoc} 

\usepackage{rotating}

\usepackage{fmultico}
\setlength{\columnseprule}{0.1pt}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{pdflscape}

\usepackage{myboiboites}


\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}


\newfontfamily\arabicfont[Script=Arabic, AutoFakeSlant=-0.02]{Amiri}







\usepackage{minitoc} 

\newboxedtheorem[boxcolor=gray!20, background=white, titlebackground=white,titleboxcolor = gray]{example}{مثال}{example}
\newenvironment{solution}{\begin{otherlanguage}{arabic}{\bf\textarabic{الحل \hspace{0.5em}}}\end{otherlanguage}\hspace{-0.7em}}{}




\begin{document}
\begin{example}[مبرهنة كثيرات الحدود]
\rm
كم هناك من معامل في تحليل كثيرات الحدود ل 
 $(x_{1} +
x_{2} + \cdots + x_{r})^{n}$؟
\end{example}
\begin{solution}
\[
(x_{1} + x_{2} + \cdots + x_{r})^{n} = \sum \left(\begin{array}{c}n\\
n_{1}, \ldots, n_{r}
\end{array}\right) x_{1}^{n_{1}} \cdots x_{r}^{n_{r}}
\]
حيث هذا الجمع هو على كل القيم الغير سالبة 
 $(n_{1}, \ldots, n_{r})$ 
 التي تحقق 
  $n_{1} + \cdots + n_{r} = n$. 
  وإذا، حسب النظرية~$6.2$،
   هناك 
    $\left(\begin{array}{c}n + r - 1\\
r - 1
\end{array}\right)$ 
معامل كهذا.
\hfill $\blacksquare$
\end{solution}


\begin{example}
\rm
لنعتبر مرة أخرى المثال ، 
أين لنا 
 $n$ 
 عنصر، 
 منها 
  $m$ 
 معيبة  
  (و لا يمكن تمييزها)
   و ال 
    $n - m$ 
    المتبقية 
     (و دائما لا يمكن تمييزها)
     غير معيبة.
 و نريد إيجاد عدد الترتيبات الخطية لهذه العناصر، حيث ليس هناك عنصران معيبان متتاليين. 
لإيجاد  عدد الترتيبات، تصور أن العناصر المعيبة مصففة على خط ما و أنه يجب وضع العناصر الغير معيبة في مواضع ما. لنرمز ب       
$x_{1}$ 
عدد العناصر الغير معيبة على يسار المعيب الأول، 
 $x_{2}$ 
 عدد العناصر الغير معيبة بين الأول و الثاني، و هكذا. 
 أي أنه لنا 
\[
x_{1}\ 0\ x_{2}\ 0 \cdots x_{m}\ 0\ x_{m + 1}
\]
الآن، سيكون على الأقل عنصر غير معيب بين كل زوج من العناصر المعيبة طالما 
 $x_{i} > 0$، $i = 2, \ldots, m$. 
و إذا، عدد المنتجات المحققة لهذه الشروط هو عدد المتجهات  
$x_{1}, \ldots, x_{m + 1}$ 
التي تحقق المعادلة
\[
x_{1} + \cdots + x_{m + 1} = n - m \quad x_{1} \geq 0,\; x_{m + 1}
\geq 0, \;x_{i} > 0, \; i = 2, \ldots,~m
\]
%\hfill$\blacksquare$
\noindent 
لكن، بوضع 
 $y_{1} = x_{1} + 1$، $y_{i} = x_{i}$، $i = 2,
\ldots, m$، $y_{m + 1} = x_{m + 1} + 1$، 
 نرى أن هذا العدد  يساوي عدد المتجهات بإحداثيات موجبة
 $(y_{1}, \ldots, y_{m + 1})$
التي تحقق المعادلة
\[
y_{1} + y_{2} + \cdots + y_{m + 1} = n - m +~2
\]

و ذاك، حسب النظرية...،
 هناك 
  $\left(\begin{array}{c}n - m + 1\\
m
\end{array}\right)$ 
منتجات كهذه، بتوافق مع نتيجة المثال. 

افترض الأن أننا نهتم بعدد المنتجات حيث  أن  هناك على الأقل عنصرين سليمين بين كل زوج من العناصر المعيبة. بنفس المنطق السابق، سيساوي هذا العدد عدد المتجهات المحققة للمعادلة 
\[
x_{1} + \cdots + x_{m + 1} = n - m \quad x_{1} \geq 0, \; x_{m + 1}
\geq 0, \; x_{i} \geq 2, \; i = 2, \ldots,~m
\]
بوضع 
 $y_{1} = x_{1} + 1$, $y_{i} = x_{i} - 1$, $i = 2, \ldots,
m$, $y_{m+1} = x_{m+1} + 1$, 
نرى أن هذا العدد يساوي عدد الحلول الموجبة للمعادلة
\[
y_{1} + \cdots + y_{m + 1} = n - 2m +~3
\]
و إذا.....،
 هناك
  $\left(\begin{array}{c}n - 2m + 2\\
m
\end{array}\right)$
 منتجات كهذه. 
\hfill$\blacksquare$
\end{example}
 \end{document}

myboiboites.sty

\RequirePackage{xkeyval} \RequirePackage{tikz}
\RequirePackage{amssymb}

\define@key{boxedtheorem}{titlecolor}{\def\titlecolor{#1}}
\define@key{boxedtheorem}{titlebackground}{\def\titlebackground{#1}}
\define@key{boxedtheorem}{background}{\def\background{#1}}
\define@key{boxedtheorem}{titleboxcolor}{\def\titleboxcolor{#1}}
\define@key{boxedtheorem}{boxcolor}{\def\boxcolor{#1}}
\define@key{boxedtheorem}{thcounter}{\def\thcounter{#1}}
\define@key{boxedtheorem}{size}{\def\size{#1}}
\presetkeys{boxedtheorem}{titlecolor = black, titlebackground = white, background = white, 
                         titleboxcolor = black, boxcolor = black, thcounter=, size = .98\textwidth}{}

\newcommand{\couleurs}[1][]{
    \setkeys{boxedtheorem}{#1}
    \tikzstyle{fancytitle} =[draw=\titleboxcolor,  fill=\titlebackground,
                            text= \titlecolor]
    \tikzstyle{mybox} = [draw=\boxcolor, fill=\background, very thick,line width=0.1pt,
                        rectangle,  inner sep=10pt, inner ysep=20pt]
}



\newsavebox{\boiboite}
\newcommand{\titre}{Titre}
\newenvironment{boite}[2][]
    {
    \renewcommand{\titre}{#2}
    \couleurs[#1]
    \begin{lrbox}{\boiboite}
     \begin{minipage}[!h]{\size}
    }
    {
     \end{minipage}
    \end{lrbox}
    \begin{center}
    \begin{tikzpicture}
    \node [mybox] (box){\usebox{\boiboite}};
    \node[fancytitle, left=10pt] at (box.north east) {\titre};
    \end{tikzpicture}
    \end{center}
    }




\newcommand{\newboxedtheorem}[4][]{
    \couleurs[#1]
    \@ifnotempty{#4}{
      \@ifundefined{the#4}{\@ifundefined{\thcounter}{\newcounter{#4}}{
      \newcounter{#4}[\thcounter ] } } { }
    }
    \newenvironment{#2}[1][]{
    \@ifnotempty{#4}{\refstepcounter{#4}}
    \begin{boite}[#1]{\RL{\textbf{#3\@ifnotempty{#4}{ \csname the#4\endcsname.}}\@ifnotempty{##1}{
    ##1}}}
    }
    {
    \end{boite}
    }
}

请问有什么方法可以解决我的包裹问题吗...非常感谢 Faouzi

答案1

你尝试过这个吗? 使用 Boiboites 软件包 TikZ 打破页面

如果它不能满足您的需要,您可以使用framed如下所示的包: http://www.texample.net/tikz/examples/framed-tikz/

我的一个联系人以前做过这件事,他得出的结论是(不确定是否最佳,但确实有效):

\RequirePackage{xkeyval}
\RequirePackage{tikz}
\RequirePackage{amssymb}
\RequirePackage{framed}
\usetikzlibrary{decorations.pathmorphing,calc}
\pgfmathsetseed{1} % To have predictable results
% Define a background layer, in which the parchment shape is drawn
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

% define styles for the normal border and the torn border
\tikzset{  fond/.style={blue!5,rounded corners=5pt,decorate}}%,
\tikzset{  bordure/.style={orange,very thick,-,rounded corners=5pt}} 
\tikzset{  titre/.style={draw,rectangle,rounded corners=5pt,fill=blue!20}}

% Macro to draw the shape behind the text, when it fits completly in the
% page
\def\parchmentframe#1{
\tikz{
  \node[inner sep=5pt] (A) {#1};  % Draw the text of the node
  \noindent
  \begin{pgfonlayer}{background}  % Draw the shape behind
  \fill[fond] 
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \draw[bordure]
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;      
  \end{pgfonlayer}}}

% Macro to draw the shape, when the text will continue in next page
\def\parchmentframetop#1{
\tikz{
  \node[inner sep=5pt] (A) {#1};    % Draw the text of the node
  \begin{pgfonlayer}{background}    
  \fill[fond]              % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \draw[bordure]
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;   
  \end{pgfonlayer}}}

% Macro to draw the shape, when the text continues from previous page
\def\parchmentframebottom#1{
\tikz{
  \node[inner sep=5pt] (A) {#1};   % Draw the text of the node
  \begin{pgfonlayer}{background}   
  \fill[fond]             % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \draw[bordure]
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;   
  \end{pgfonlayer}}}

% Macro to draw the shape, when both the text continues from previous page
% and it will continue in next page
\def\parchmentframemiddle#1{
\tikz{
  \node[inner sep=5pt] (A) {#1};   % Draw the text of the node
  \begin{pgfonlayer}{background}   
  \fill[fond]             % Draw the ``complete shape'' behind
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;
  \draw[bordure]
        (A.south east) -- (A.south west) -- 
        (A.north west) -- (A.north east) -- cycle;   
  \end{pgfonlayer}}}

% Define the environment which puts the frame
% In this case, the environment also accepts an argument with an optional
% title (which defaults to ``Th\'eor\`eme'', which is typeset in a box     overlaid
% on the top border
\newcounter{ctheo}[chapter]%définition d'un compteur
\newenvironment{theo}[1][Th\'eor\`eme.]{%
  \noindent
  \stepcounter{ctheo}
  \def\FrameCommand{\parchmentframe}%
  \def\FirstFrameCommand{\parchmentframetop}%
  \def\LastFrameCommand{\parchmentframebottom}%
  \def\MidFrameCommand{\parchmentframemiddle}%
  \vskip\baselineskip
  \MakeFramed {\FrameRestore}
  \noindent  \tikz  \node[inner sep=1ex,titre,anchor=west, overlay] at (0pt,     8pt) {\sffamily#1 \thectheo .}; \par \noindent}%
{\endMakeFramed}

这个解决方案的主要问题是您必须以这种方式定义每个环境,而不能使用宏\newboxedtheorem来生成环境。

相关内容