0
\documentclass[12pt, a4paper, UTF8, scheme = plain, twoside]{ctexart}
\usepackage{lipsum}
\usepackage{amsmath,enumerate}
\usepackage[margin = 2cm]{geometry}
\usepackage{adjustbox}
\usepackage{fancyhdr}
\usepackage{totpages}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfootoffset[R]{-2.28cm}
\usepackage{pdfpages}
\usepackage{hyperref}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand\tableofcontents{
    \@starttoc{toc}
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[type={CC}, modifier={by-nc-nd}, version={4.0} ]{doclicense}
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse}
\tcbset{%
    colback      = white,
    colframe     = black,
    title filled = false
}
\NewTColorBox[
    auto counter,
    number freestyle =  { Q\noexpand\arabic{\tcbcounter} }
    ]{question}{ O{}mo }{
    lowerbox         =  ignored, %invisible/ignored
    fonttitle        =  \bfseries,
    title            =  \thetcbcounter: #2,
% after title/after upper
    after title      =  {\hfill Page~\label{tb\thetcbcounter}\pageref{tb\thetcbcounter}\ of~\pageref{TotPages}},
    #1
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mytopic}[1]{%%%%%%%%%%%%%%%%%%%
    \begin{question}{ Test }
        #1
    \end{question}
}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\parindent}{0pt}
%%%%% QR
\usepackage{qrcode}
\usepackage{background}
\backgroundsetup{
    contents  = {\qrcode[hyperlink,height=2cm]{http://www.latex.earth}},
    pages     = all,
    placement = bottom,
    color     = black,
    scale     = 1,
    opacity   = 0.5,
    hshift    = 9cm,
    vshift    = 0.5cm
}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\clearpage
\thispagestyle{empty}
\tableofcontents
\newgeometry{top=0.5cm,left=1.5cm,right=0.5cm,bottom=2.28cm}
\lipsum[7]
\pagestyle{fancy}%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lipsum[8]
%%%%%\input{chap1.tex}
\mytopic{\lipsum[1]}
\mytopic{\lipsum[2]}
\mytopic{\lipsum[3]}
\section{111111}
\mytopic{\lipsum[4-5]}
\mytopic{\lipsum[8]}
%% \lipsum[6]
\mytopic{\lipsum[10]}
\mytopic{\lipsum[1]}
\lipsum[9]
\normalsize%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newgeometry{top=0.5cm,left=0.5cm,right=0.5cm,bottom=2.28cm}
\lipsum[7-13]
\newgeometry{margin = 2cm}
\lipsum[1-6]
\clearpage
\mytopic{\lipsum[3]}
\mytopic{\lipsum[4-5]}
\mytopic{\lipsum[8]}
\mytopic{\lipsum[10]}
\mytopic{\lipsum[1]}
\section{33333333}
\mytopic{\lipsum[8]}
\mytopic{\lipsum[4-5]}
\mytopic{\lipsum[3]}
\clearpage%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{empty}%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace*{\fill}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\huge [THIS PAGE IS INTENTIONALLY LEFT BLANK.]}
\vspace*{\fill}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This code produces some problem with the QR (background) as shown:

enter image description here enter image description here

On some pages, it's fine, but on some others, it's not.

I have found that if I comment out these lines

\makeatletter
\renewcommand\tableofcontents{
    \@starttoc{toc}
}
\makeatother

where I used to fix the tableofcontents. Then it works fine again...

Why? How can I fix this while keep not showing Contents itself?

Update: 14 Dec 2022 Some have suggested that to use article class instead, but I got the same problem with multiple compilations...

Is this possibly a bug from MikTeX distribution?

Would that help if I post the log as well?

Anyone got any clues?

8
  • which engine do you use? And is your tex system up-to-date? Dec 9, 2022 at 8:59
  • 1
    You really should try to make more reasonable examples if asking people to trace code. Do you need a 10 page document full of complicated tcolorbox code to show a problem with QR codes??? I get a fatal font error with ctexart but if I change the class to article I get this which I think is OK Dec 9, 2022 at 9:35
  • @DavidCarlisle Well I am not sure up to which page the QR code would be missing as in the real file, it seemed pretty random. So I made it fairly random length, in this case, which is about 10 pages.
    – CasperYC
    Dec 9, 2022 at 14:11
  • @UlrikeFischer Lastest MikTex and using pdflatex, running on Win10 pro.
    – CasperYC
    Dec 9, 2022 at 14:12
  • @DavidCarlisle That's weird. I am using the lastest MikTeX and compile with pdflatex (twice), if I only change it to artical class, I still get the same problem.....
    – CasperYC
    Dec 9, 2022 at 14:15

0

You must log in to answer this question.

Browse other questions tagged .