\documentclass[12pt,a4paper]{ctexart}
\ctexset{
section={
name={Week},
number={~\arabic{section}}
}
}%
\usepackage{standalone}
\usepackage{amsmath}
\usepackage{fancybox} % fancybox~~~
% Graphicx
\usepackage{graphicx}
\graphicspath{{./figs/}}
%
\usepackage{bookmark}
\usepackage{hyperref}
\hypersetup{
bookmarksopen=false,
pdfstartview= FitH
}
\usepackage[top=1cm,left=1cm,right=1cm,bottom=1cm]{geometry}
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse}
\tcbset{%
colback=white,
tikz={opacity=0.1,transparency group},
colframe=black,
title filled=false,
% bookmark={Q\arabic{\tcbcounter}}
bookmark={W\thesection\_Q\arabic{\tcbcounter}}
}
%%%%%%%% disable for publishing %%%%%%
\hypersetup{bookmarksdepth=-1}
\NewTColorBox[
auto counter,
number freestyle={ W\noexpand\thesection/Q\noexpand\arabic{\tcbcounter} }
]{question}{ O{}mo }{
lowerbox=ignored, %invisible/ignored
fonttitle=\bfseries,
title=\thetcbcounter: #2,
% after title/after upper
IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3}}}{},
before = \clearpage,
#1
}%
\usepackage{lipsum} % for dummy text only
\begin{document}
\pagestyle{empty}
\setlength{\parindent}{0pt}
%%
\section[Week \thesection]{}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\section[Week \thesection]{}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\begin{question}{Tiiiiiiiiitle}[Whatever]
lipsum[4]
\end{question}
\end{document}
Notice how the \clearpage did not work on page 3 for the new section?
Is there a way to make it work?
\sectioncommand which avoid the effect of\clearpage. Why? I don't know. But if you introduce some text before first section you will see how the text, section title and first box remain on same page. Just like it happens with fourth box where third box, section title and fourth box remain on page. – Ignasi Apr 30 '20 at 17:36\section, you should find how to forcesectionto start a new page. Something like this – Ignasi May 01 '20 at 08:29