tcolorbox 的编号

tcolorbox 的编号

我有一系列 tcolorboxes,我使用 \thetcbcounter 对它们进行编号(它们代表项目的不同阶段)。

问题是,它会自动编号为 1.1、1.2、1.3 等,但我希望它们编号为 1、2、3 等。我是否必须在 \thetcbcounter 上添加特殊参数才能这样?

谢谢

编辑:我没有分享代码,因为它无法在所有图片上运行,但你可以看看。这是我的完整代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=0.8in,right=0.8in,top=0.5in,bottom=0.8in]{geometry}
\usepackage{array}
\usepackage[table, x11names]{xcolor}
\usepackage{array, multirow}
\usepackage{makecell, hhline}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadalign{lc}
\newcommand\whitecell[1]{\cellcolor{white}{#1}}

\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{listings}

\usepackage[many]{tcolorbox}

\begin{document}
\begin{center}
\begin{tcolorbox}[halign= flush center, fonttitle=\sffamily\bfseries\large, title={Lecteur DVD LG=Model GSA-H10N}, width=\linewidth/2]
\includegraphics[height=3cm]{Picture1.jpg}
\end{tcolorbox}
\end{center}
\tcbset{on line,before upper=\strut,width=10cm}

\vspace{10px} %%%%%%%%% Adding space %%%%%%%%%
\begin{minipage}{.45\linewidth}
\begin{flushleft} 
\tcbox[tcbox width=auto]{PHASES DE DEMONTAGE}
\end{flushleft} 
\end{minipage}
\hfill
\begin{minipage}{.45\linewidth}
\begin{flushright}
\tcbox[tcbox width=auto limited]{ATTACHEMENTS}
\end{flushright}
\end{minipage}

\newtcolorbox[auto counter, number within=section]{mybox}[1]{fonttitle=\sffamily\bfseries\large, sidebyside, lefthand width=6.5cm,
  enhanced, remember as=first,
  title=#1,
  overlay unbroken and first ={
    \node[anchor=north east,rounded corners,draw=black!80,fill=gray!30,line width=0.5mm,text width=2.5em,align=center,minimum height=4ex] at ([xshift=-\marginparsep]frame.north west) {\thetcbcounter};
  }
}

\vspace{10px}
%%%%%%%%%%%%%%%% Phase 1
\begin{minipage}{.45\linewidth}
\begin{flushleft} 
\begin{mybox}{Démontage du boitier}
\includegraphics[height=3cm]{Picture2.JPG}% 
\hspace{10px}\includegraphics[height=3cm]{Picture3.jpg}
\tcblower
\underline{Temps:}\\\\ 4 min.\\ 30 sec.
\end{mybox}
\end{flushleft} 
\end{minipage}
\hfill
\begin{minipage}{.45\linewidth}
\begin{flushright}
\begin{tcolorbox}[enhanced, width=4.5cm,
halign=center,valign=center,
square, remember as=second]
\includegraphics[height=3.5cm]{Picture4.JPG}
\end{tcolorbox}
\end{flushright}
\end{minipage}

\begin{tikzpicture}[overlay,remember picture,line width=1mm,draw=red!75!black]
\draw[->] (first.east) to (second.west);
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%% Phase 2
\begin{minipage}{.45\linewidth}
\begin{flushleft} 
\begin{mybox}{Démontage de la carte mère}
\includegraphics[height=3cm]{Picture2.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture5.JPG}
\tcblower
\underline{Temps:}\\\\ 1 min.\\ 25 sec.
\end{mybox}
\end{flushleft} 
\end{minipage}
\hfill
\begin{minipage}{.45\linewidth}
\begin{flushright}
\begin{tcolorbox}[enhanced, width=4.5cm,
halign=center,valign=center,
square, remember as=third]
This is a \textbf{tcolorbox}.
\end{tcolorbox}
\end{flushright}
\end{minipage}

\begin{tikzpicture}[overlay,remember picture,line width=1mm,draw=red!75!black]
\draw[->] (first.east) to (third.west);
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%% Phase 3
\begin{mybox}{Démontage du moteur d'ouverture du lecteur}
\includegraphics[height=3cm]{Picture6.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture7.JPG}
\tcblower
\underline{Temps:}\\\\ 45 sec.
\end{mybox}
%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%% Phase 4
\begin{mybox}{Démontage de la tête de lecture}
\includegraphics[height=3cm]{Picture8.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture9.JPG}
\tcblower
\underline{Temps:}\\\\ 1 min.
\end{mybox}
%%%%%%%%%%%%%%%%%%%%%%%%

\begin{center}
\begin{tcolorbox}[sidebyside, fonttitle=\sffamily\bfseries\large, title={Première étape de démontage}, width=15cm, halign title=flush center]
\includegraphics[height=5cm]{Picture10.JPG}
\tcblower
\underline{Temps total:} 7 min. 30 sec.\\\\
\underline{Eléments démontés:}\\
\begin{itemize}
  \item Boitier aluminium
  \item Carte mère
  \item Support CD plastique
  \item Moteur d'ouverture du lecteur
  \item Tête de lecture
\end{itemize}
\end{tcolorbox}
\end{center}

%%%%%%%%%%%%%%%% Phase 5
\begin{mybox}{Démontage de la partie métallique}
\includegraphics[height=3cm]{Picture8.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture9.JPG}
\tcblower
\underline{Temps:}\\\\ 30 sec.
\end{mybox}
%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%% Phase 6
\begin{mybox}{Démontage de }
\includegraphics[height=3cm]{Picture8.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture9.JPG}
\tcblower
\underline{Temps:}\\\\ 1 min.
\end{mybox}
%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%% Phase 7
\begin{mybox}{Démontage de }
\includegraphics[height=3cm]{Picture8.JPG}%
\hspace{10px}\includegraphics[height=3cm]{Picture9.JPG}
\tcblower
\underline{Temps:}\\\\ 1 min.
\end{mybox}
%%%%%%%%%%%%%%%%%%%%%%%%

\end{document}

图片上是这样的 在此处输入图片描述

答案1

您已经对number within=section部分内的框进行了编号,并在前面添加了部分编号。

删除number within=section并且用简单的计数器对框进行编号。

相关内容