我的代码源于这个回答:https://ask.latexstudio.net/ask/question/7305.html
我在该回答的基础上,把每句名言的位置替换成了parbox,以加入图片等更多内容,但一旦页面被占满,图片将会出现bug,如图
这个是正常的,上面有空白
这个是bug了的,上面被占满了
我的部分源代码及附件如下
\documentclass[UTF8,zihao=5,a4paper,linespread=1.20,twoside,AutoFakeBold,notitlepage,openany]{ctexbook}
\usepackage[top=20mm,bottom=25mm,left=15mm,right=15mm]{geometry}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\tcbuselibrary{skins}
\usepackage{xcolor}
\definecolor{cblue}{HTML}{D2E8FA}%浅蓝色,用于页脚
\definecolor{cgreen}{HTML}{E2F0D9}
\usepackage{fancyhdr}%页眉页脚
\usepackage{xparse}
\newcommand{\smallcolorbox}[2]{\parbox{60pt}{\begin{tcolorbox}[colback={cgreen},arc={4pt},toprule={0pt},bottomrule={0pt},leftrule={0pt},rightrule={0pt},top={0pt},bottom={0pt},left={0pt},right={0pt},breakable,enhanced jigsaw]\parbox{12pt}{\centering\includegraphics[width=10pt]{./素材/#1.png}}\parbox{45pt}{\zihao{-5}\centering\bfseries #2}\end{tcolorbox}}}
\ExplSyntaxOn%代码来源:https://ask.latexstudio.net/ask/question/7305.html
\seq_new:N \g__wisdom_seq
\int_new:N \g__wisdom_idx_int
\int_gzero:N \g__wisdom_idx_int
\msg_new:nnn { wisdom } { invalid } { Invalid~index! }
\NewDocumentCommand \setwisdom { O{\\} m }
{
\set_wisdom:nn { #1 } { #2 }
}
\NewDocumentCommand \addwisdom { O{\\} m }
{
\add_wisdom:nn { #1 } { #2 }
}
\NewDocumentCommand \usewisdom { o }
{
\IfValueTF { #1 }
{
\int_compare:nTF
{ 1 <= #1 <= \seq_count:N \g__wisdom_seq }
{ \seq_item:Nn \g__wisdom_seq { #1 } }
{ \msg_error:nn { wisdom } { invalid } }
}
{ \use_wisdom: }
}
\cs_new_protected:Nn \set_wisdom:nn
{
\seq_gclear:N \g__wisdom_seq
\seq_gset_split:Nnn \g__wisdom_seq { #1 } { #2 }
}
\cs_new_protected:Nn \add_wisdom:nn
{
\seq_set_split:Nnn \l_tmpa_seq { #1 } { #2 }
\seq_gconcat:NNN \g__wisdom_seq \g__wisdom_seq \l_tmpa_seq
}
\cs_new_protected:Nn \use_wisdom:
{
\int_compare:nTF
{ \g__wisdom_idx_int = \seq_count:N \g__wisdom_seq }
{ \int_gzero:N \g__wisdom_idx_int }
{ \int_gincr:N \g__wisdom_idx_int }
\seq_item:Nn \g__wisdom_seq { \g__wisdom_idx_int }
}
\ExplSyntaxOff
\fancyhf{}
\pagestyle{fancy}
\fancyhead[OR]{\rightmark}%页眉
\fancyhead[EL]{\leftmark}
\fancyfoot[OC]{\rule{512pt}{0.6pt}\vspace*{-1pt}\\\colorbox{cblue}{\parbox[c][70pt][t]{506pt}{\zihao{-5}\usewisdom\hspace*{12pt}\parbox[t][20pt][c]{15pt}{\zihao{4}\centering\itshape\thepage}\hspace*{3pt}}}}%页脚
\fancyfoot[EC]{\rule{512pt}{0.6pt}\vspace*{-1pt}\\\colorbox{cblue}{\parbox[c][70pt][t]{506pt}{\zihao{-5}\hspace*{3pt}\parbox[t][20pt][c]{15pt}{\zihao{4}\centering\itshape\thepage}\hspace*{12pt}\usewisdom}}}
\renewcommand{\headrulewidth}{0.3pt}
\renewcommand{\footrulewidth}{0pt}
\newcommand{\addtowisdom}[2]{\parbox[t][60pt][t]{461pt}{#1 \hspace{5pt}#2}}
\newcommand{\mathone}{\smallcolorbox{趣味数学}{趣味数学}}
\newcommand{\mathtwo}{\smallcolorbox{数学分支}{数学分支}}
\newcommand{\maththree}{\smallcolorbox{数学家}{数学家}}
\newcommand{\mathfour}{\smallcolorbox{数学史}{数学史}}
\newcommand{\mathfive}{\smallcolorbox{数学笑话}{数学笑话}}
\setwisdom{
\addtowisdom{\mathone}{牛顿是一个非常厉害的数学家}\\
\addtowisdom{\mathtwo}{牛顿是一个非常厉害的数学家}\\
\addtowisdom{\maththree}{牛顿是一个非常厉害的数学家}\\
\addtowisdom{\mathfour}{牛顿是一个非常厉害的数学家}\\
\addtowisdom{\mathfive}{牛顿是一个非常厉害的数学家}\\
\addtowisdom{\mathone}{牛顿是一个非常厉害的数学家}\\
}
\usepackage{zhlipsum}
\begin{document}
\zhlipsum[1-60]\newpage
\begin{verbatim}
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
0 1
2
3
4
5
6
7
8
9
0 1
2
3
4
5
6
7
8
9
0 1
2
3
4
5
6
7
8
9
0 1
2
3
4
5
6
7
8
9
0
\end{verbatim}
\end{document}
以下是所引用的素材,和正文放到同一文件夹下
素材.rar
好了,感谢感谢!