線で結ばれた異なる色の円で囲まれた列挙を設定する方法

線で結ばれた異なる色の円で囲まれた列挙を設定する方法

私の目標は、以下に示すように列挙することです。

ここに画像の説明を入力してください

以下にいくつかのコードを修正しました。

\documentclass[]{article}
\usepackage{tikz}
\usepackage{enumitem}
\usepackage{xcolor}
\newcommand*\mycirc[1]{\tikz[baseline=(myc.base)]{\node[shape=circle,fill=green!75!black,inner sep=2.2pt](myc){#1};}}
\begin{document}
\begin{enumerate}[label=\protect\mycirc{\bfseries \arabic*}]
\item You decide to use the normal distribution to approximate the binomial distribution. You want to know the probability of getting exactly 16 tails out of 20 coin flips.
\begin{enumerate}[label=\textbf{\alph*}]
\item
\item
\item
\end{enumerate}
\item 108 people took a test for which the probability of passing is 0.88. Let \textit{X} be the number of people who passed the test. Using the normal distribution .... 
\end{enumerate}
\end{document}

その結果、以下の画像が生まれました。

ここに画像の説明を入力してください

@yannisl のコメントでリクエストされた追加画像 ここに画像の説明を入力してください

答え1

図1

私は に基づくソリューションを提案しますtcolorboxenumerate環境は に変更され、lenumerate色と、テキストの左余白から列挙の垂直セグメントまでの距離という 2 つの引数を受け取ります。

述べる。質問者の初期コードをそのまま維持しました。

アップデート。列挙が 2 ページに分割された場合でも機能するようにコードを変更しました。3 ページに分割された場合に何が起こるかは確認していません。おそらく機能しないと思いますが、次のようなものを使用すればoverlay middle機能するはずです...

コード

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tcolorbox}
\tcbuselibrary{skins, breakable}
\tcbset{shield externalize}

\usepackage{enumitem}
\usepackage{lipsum}

\newcommand*\mycirc[2]{%
  \tikz[baseline=(myc.base)] {%
    \node[shape=circle, fill=#2, inner sep=2.2pt] (myc) {#1};
  }
}

\newenvironment{noticeB}[2]{%  color, delta x
  \tcolorbox[%
  notitle,
  empty,
  enhanced,  % delete the edge of the bottom page for a broken box
  breakable,
  coltext=black,
  opacityback=0,
  fontupper=\rmfamily,
  parbox=false,
  noparskip,
  boxrule=-1pt,  % width of the box' edges
  frame hidden,
  left=0\parindent,  % inner space from text to the left edge
  right=0\parindent,
  top=-1pt,
  bottom=5pt,
  % boxsep=0pt,
  before skip=2ex,
  after skip=2ex,
  overlay unbroken and first={%
    \draw[color=#1, fill=#1, line width=1pt]
    ($(frame.north west) +(#2, -15pt)$)
    -- ($(frame.south west) +(#2, 7pt)$);
  },
  overlay unbroken={%
    \draw[color=#1, fill=#1, line width=1pt]
    ($(frame.north west) +(#2, -15pt)$)
    -- ($(frame.south west) +(#2, 7pt)$) circle (1.5pt);
  },
  overlay last={%
    \draw[color=#1, fill=#1, line width=1pt]
    ($(frame.north west) +(#2, -1pt)$)
    -- ($(frame.south west) +(#2, 7pt)$) circle (1.5pt);
  }]
}{\endtcolorbox}

\newenvironment{lenumerate}[2]{%
  \begin{noticeB}{#1}{#2}%
    \begin{enumerate}[label=\protect\mycirc{\bfseries \arabic*}{#1}]}{%
    \end{enumerate}
  \end{noticeB}
}

\begin{document}

\lipsum[1]
\begin{lenumerate}{green!65!black}{11pt}
\item
  You decide to use the normal distribution to approximate the
  binomial distribution. You want to know the probability of getting
  exactly 16 tails out of 20 coin flips. 
  \begin{enumerate}[label=\textbf{\alph*.}]
  \item
    Some text.
  \item
    Some mode text.
  \item
    Well\ldots
  \end{enumerate}
\item
  108 people took a test for which the probability of passing is
  0.88. Let \textit{X} be the number of people who passed the
  test. Using the normal distribution\ldots
\end{lenumerate}

\lipsum[2]
\end{document}

関連情報