列表和子列表内的框

列表和子列表内的框

需要创建带阴影的框环绕列表,而不影响列表样式,框可能来自子列表和子子列表,有没有办法像附图那样修复,在我的书中有数千个带有阴影框的列表,我们需要自动化解决方案:在此处输入图片描述 请查看 MWE:

\documentclass{book}
\usepackage[most]{tcolorbox}

\begin{document}
\begin{enumerate}
\item[1.] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;

\begin{tcolorbox}
\item[2.] Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[3.] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\end{tcolorbox}
\item[4.] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\end{enumerate}


\begin{enumerate}
\item[\textbullet] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;

\begin{tcolorbox}
\item[\textbullet] Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[\textbullet] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\end{tcolorbox}
\item[\textbullet] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\item[\textbullet] Revisions to address preparation and presentation of information and pressure to breach the fundamental principles, developed under the IESBA Part C project - Phase 1 (sections 220 and 270); and
\item[\textbullet] Revisions to the provisions pertaining to the offering and accepting of inducements, developed under the IESBA Part C project - Phase 2 (sections 250 and 340).
\end{enumerate}
\end{document} 

答案1

我或多或少是在抄袭这个答案。为了有框,您需要\StartBox在框开始的行和\EndBox结束的行中放置 。它支持分页符。您最多需要编译三次。

\documentclass{article}
\usepackage{tikz}
\usepackage{refcount}
\usetikzlibrary{backgrounds,calc}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\tikzset{SimpleBox/.style={fill=gray,fill opacity=0.3}}



\newcounter{tmp}

\newcommand{\StartBox}[1][]{%
  \stepcounter{tmp}%from https://tex.stackexchange.com/a/52579/121799
  \tikz[remember picture,overlay, baseline=(Begin.base)]{%
  \node[anchor=base,inner sep=0pt,outer sep=0pt] (Begin) {\strut};}
  \label{a\thetmp}%
  \ifnum\getpagerefnumber{a\thetmp}=\getpagerefnumber{b\thetmp} \else
  \begin{tikzpicture}[overlay, remember picture]
   \path (current page text area.north west) -- (current page text area.south west)
    node(WestLine)[left]{};
   \path (current page text area.north east) -- (current page text area.south east)
    node(EastLine)[right]{};
   \begin{scope}[on background layer,blend mode=multiply]
   \draw[SimpleBox,#1] ($(current page text area.south-|WestLine)-(0,2pt)$)
   --      (Begin.north-|WestLine) -- (Begin.north-|EastLine) 
   --  ($(current page text area.south-|EastLine)-(0,2pt)$);
   \end{scope}
  \end{tikzpicture}%
  \fi%
}

\newcommand{\EndBox}[1][]{%
\tikz[remember picture,overlay, baseline=(End.base)]{%
\node[anchor=base,inner sep=0pt,outer sep=0pt] (End) {\strut};}%
  \label{b\thetmp}
  \ifnum\getpagerefnumber{a\thetmp}=\getpagerefnumber{b\thetmp}
  \begin{tikzpicture}[overlay,remember picture]
   \path (current page text area.north west) -- (current page text area.south west)
    node(WestLine)[left]{};
   \path (current page text area.north east) -- (current page text area.south east)
    node(EastLine)[right]{};
   \begin{scope}[on background layer,blend mode=multiply]
    \draw[SimpleBox,#1] (Begin.north-|WestLine) rectangle (End.south-|EastLine);
   \end{scope}
  \end{tikzpicture}
  \else
  \begin{tikzpicture}[overlay,remember picture]
   \path (current page text area.north west) -- (current page text area.south west)
    node(WestLine)[left]{};
   \path (current page text area.north east) -- (current page text area.south east)
    node(EastLine)[right]{};
   \begin{scope}[on background layer,blend mode=multiply]
   \draw[SimpleBox,#1] ($(current page text area.north-|WestLine)+(0,2pt)$)
   --      (End.south-|WestLine) -- (End.south-|EastLine) 
   --  ($(current page text area.north-|EastLine)-(0,2pt)$);
   \end{scope}
  \end{tikzpicture}
  \fi
}

\newcommand{\SimpleBox}[2][]{%
\StartBox[#1]%
#2\EndBox[#1]}


\begin{document}

\begin{enumerate}
\item[1.] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;

\item[2.] \StartBox Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[3.] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\EndBox
\item[4.] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\end{enumerate}


\begin{enumerate}
\item[\textbullet] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;


\item[\textbullet]  \StartBox Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[\textbullet] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\EndBox
\item[\textbullet] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\item[\textbullet] Revisions to address preparation and presentation of information and pressure to breach the fundamental principles, developed under the IESBA Part C project - Phase 1 (sections 220 and 270); and
\item[\textbullet] \StartBox Revisions to the provisions pertaining to the offering and accepting of inducements, developed under the IESBA Part C project - Phase 2 (sections 250 and 340).
\item[\textbullet] Hibernation is very important.
\item[\textbullet] Honey liquor is also important.\EndBox
\end{enumerate}

\begin{enumerate}
\item[1.] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;

\item[2.] \StartBox Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[3.] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\EndBox
\item[4.] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\end{enumerate}

\begin{enumerate}
\item[\textbullet] Structural and drafting enhancements developed under the International Ethics Standards Board for Accountants (IESBA) Structure of the Code project;


\item[\textbullet]  \StartBox Revisions to the provisions pertaining to safeguards in the Code, developed under the IESBA Safeguards project;
\item[\textbullet] Revisions to clarify the applicability of the provisions in Part C of the extant Code to members in public practice, developed under the IESBA Applicability project (paragraphs R120.4, R300.5 and 300.5 A1);
\EndBox
\item[\textbullet] New application material relating to professional skepticism and professional judgment, developed under the IESBA Professional Skepticism (short-term) project (paragraphs 120.5 A1, 120.5 A2, 120.5 A3, 120.13 A1 and 120.13 A2)
\item[\textbullet] Revisions to address preparation and presentation of information and pressure to breach the fundamental principles, developed under the IESBA Part C project - Phase 1 (sections 220 and 270); and
\item[\textbullet] \StartBox Revisions to the provisions pertaining to the offering and accepting of inducements, developed under the IESBA Part C project - Phase 2 (sections 250 and 340).
\item[\textbullet] Hibernation is very important.
\item[\textbullet] Honey liquor is also important.\EndBox
\end{enumerate}
\end{document}

在此处输入图片描述

相关内容