一个漂亮的彩色盒子,带有圆圈,并进行了一些修改

一个漂亮的彩色盒子,带有圆圈,并进行了一些修改

我想要制作一个如图所示的特殊盒子。

在此处输入图片描述

我读过这两本指南mdframedtcolorbox但我没有找到任何可以适应这张图片的东西。如果我没有提供任何内容,我首先表示歉意,MWE但我不知道从哪里开始。我认为你可以真诚地这样做TikZ

在我的书中,我使用( )Times New Roman作为文本,作为标题和图像的名称(例如图 1:)Optima fonturw-classico

是否可以使用与图像类似的不同默认字体来编写“快速测试”(或其他文本),其侧边框由点或小三角形组成,末尾带有彩色点?

答案1

这是 David Purton 在聊天中发布的答案的代码。非常感谢 David。请不要为我投票,非常感谢。

在此处输入图片描述

\documentclass{article}

\usepackage{lipsum}

\usepackage[breakable,skins]{tcolorbox}

\newtcolorbox[auto counter, number within=section]{quickquiz}[1][]{%
  enhanced, breakable, fonttitle=\sffamily\bfseries\Large,
  title=Q, fontupper=\bfseries, left=\tcboxedtitlewidth,
  boxsep=0pt, top=2mm, right=2mm, bottom=2mm+0.7\baselineskip,
  sharp corners, colback=white, colbacktitle=orange, frame hidden,
  pad before break=-0.7\baselineskip,
  before upper = {\begingroup\sffamily\bfseries\Large
    \textcolor{green!50!black}{uick Quiz}
    \textcolor{orange}{\thetcbcounter}\quad\endgroup},
  attach boxed title to top left={
    yshift=-\tcboxedtitleheight+2pt-2mm},
  boxed title style={
    empty, left=0mm, right=0mm, top=0mm, bottom=0mm, boxsep=2pt},
  underlay boxed title={
    \path[fill=tcbcolbacktitle] (title) circle (\tcboxedtitleheight/2);},
  overlay unbroken={
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=-\tcboxedtitleheight-0.7\baselineskip] (nw) at (frame.north west);
    \node (sw) [circle, fill=orange, inner sep=2pt,
      xshift=\tcboxedtitlewidth/2, yshift=\tcboxedtitlewidth/2]
      at (frame.south west) {};
    \draw[gray, line cap=round, line width=2pt,
      dash pattern=on 0pt off 4\pgflinewidth] (nw) -- (sw);},
  overlay first={
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=-\tcboxedtitleheight-0.7\baselineskip] (nw) at (frame.north west);
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=0.7\baselineskip] (sw) at (frame.south west);
    \draw[gray, line cap=round, line width=2pt,
      dash pattern=on 0pt off 4\pgflinewidth] (nw) -- (sw);},
  overlay middle={
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=-0.7\baselineskip] (nw) at (frame.north west);
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=0.7\baselineskip] (sw) at (frame.south west);
    \draw[gray, line cap=round, line width=2pt,
      dash pattern=on 0pt off 4\pgflinewidth] (nw) -- (sw);},
  overlay last={
    \coordinate[xshift=\tcboxedtitlewidth/2,
      yshift=-0.7\baselineskip] (nw) at (frame.north west);
    \node (sw) [circle, fill=orange, inner sep=2pt,
      xshift=\tcboxedtitlewidth/2, yshift=\tcboxedtitlewidth/2]
      at (frame.south west) {};
    \draw[gray, line cap=round, line width=2pt,
      dash pattern=on 0pt off 4\pgflinewidth] (nw) -- (sw);},
  #1}

\begin{document}
\section{First Section}

\begin{quickquiz}[label=QQ:A]
  \lipsum[1]
\end{quickquiz}

\begin{quickquiz}[label=QQ:B]
  \lipsum[2]
\end{quickquiz}

\section{Second Section}

\begin{quickquiz}[label=QQ:C]
  \lipsum
\end{quickquiz}

\begin{quickquiz}[label=QQ:D]
  \lipsum[4]
\end{quickquiz}

Cross references work: see Quick Quiz \ref{QQ:A}.

\end{document}

相关内容