使用 pdfpages 时,我遇到了带有框架样式的 titlesec 格式的问题。
有什么想法吗?这是我的 MWE(您可以包含任何虚拟 pdf):
\documentclass{report}
\usepackage{pdfpages}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage[toc,page]{appendix}
% renamming stuff
\renewcommand{\appendixname}{Annexe}
\renewcommand{\appendixpagename}{Annexes}
\renewcommand{\appendixtocname}{Annexes}
\renewcommand{\setthesection}{\Alph{section}}
% Title style
\makeatletter
\titleformat{\chapter}[frame]
{\normalfont}
{ \filright
\MakeUppercase{\chaptertitlename}\
\thechapter
\enspace
}
{0.5em}
{\Large\filleft\textsc}
\titlespacing*{\chapter}{0pt}{25pt}{25pt}
\makeatother
\begin{document}
\begin{appendices}
\chapter{TEST}
\pagebreak
\includepdf[
pages=-,
offset=0cm -1cm,
width=\textwidth,
pagecommand={
\chapter{Breaking example}
},
]{example-image-duck.pdf}
\end{appendices}
\end{document}
答案1
includepdf 将 \fboxrule 设置为零,因此规则不再可见。您可以在 page 命令中重置它:
\documentclass{report}
\usepackage{pdfpages}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage[toc,page]{appendix}
% renamming stuff
\renewcommand{\appendixname}{Annexe}
\renewcommand{\appendixpagename}{Annexes}
\renewcommand{\appendixtocname}{Annexes}
\renewcommand{\setthesection}{\Alph{section}}
% Title style
\makeatletter
\titleformat{\chapter}[frame]
{\normalfont}
{ \filright
\MakeUppercase{\chaptertitlename}\
\thechapter
\enspace
}
{0.5em}
{\Large\filleft\textsc}
\titlespacing*{\chapter}{0pt}{25pt}{25pt}
\makeatother
\begin{document}
\begin{appendices}
\chapter{TEST}
\pagebreak
\includepdf[
pages=1-10,
offset=0cm -1cm,
width=\textwidth,
pagecommand={
\fboxrule0.4pt
\chapter{Breaking example}
},
]{example-image-duck.pdf}
\end{appendices}
\end{document}