自動調整框以適合頁面

自動調整框以適合頁面

我正在努力克服我遇到的一個問題。我希望顏色框適合頁面,而不會超出頁腳或頁面並在下一頁重新開始。有什麼辦法可以讓我做到這一點。

預先感謝您的建議和解決方案

\documentclass{report}
\usepackage[dvipsnames,table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}

\usepackage{setspace}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{eurosym}
\usepackage{amstext}
\usepackage{hyperref}
\usepackage{grffile} %Stops the file name of figures appearing
\usepackage{color}
\usepackage{mathabx}
\usepackage{float}
\usepackage{pdfpages}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\DeclareRobustCommand{\officialeuro}{%
  \ifmmode\expandafter\text\fi
  {\fontencoding{U}\fontfamily{eurosym}\selectfont e}}

\usepackage{url}
\usepackage{background}
\usepackage{lastpage}

\usepackage[most]{tcolorbox}


\title{Business Plan}
\author{}
\onehalfspacing
\usepackage{algorithmic}
 \renewcommand{\familydefault}{\sfdefault}
\textheight=23cm \textwidth=16cm \topmargin=-2cm \oddsidemargin=0cm
\parindent=0mm
\pretolerance=2000 \tolerance=3000

\usepackage{glossaries}

\makenoidxglossaries %glossaries

\backgroundsetup{
  scale=1,
  color=black,
  opacity=1,
  angle=0,
  position=current page.south,
  vshift=60pt,
  contents={%
  \small\sffamily%
  \begin{minipage}{.8\textwidth}
  \parbox[b]{.6\textwidth}{%
    Page \thepage\ of   \pageref{LastPage}}\hfill
  \parbox[b]{.4\textwidth}{%
    \raggedleft xxxx \\ xxx, xxx}\      \textcolor{red}{\rule{\textwidth}{1.5pt}}\      \url{www.xxx.co.uk}
  \end{minipage}\hspace{.02\textwidth}%
  \begin{minipage}{.18\textwidth}
  \includegraphics[width=\linewidth,height=70pt,keepaspectratio]{iPhone app}
  \end{minipage}%
  }
}

\tcbset{rawlings/.style={width=\textwidth,colback={white},colbacktitle=SkyBlue,coltitle=black,colupper=black}}

\newtcolorbox[auto counter,list inside=rawlings]{rawlingsbox}[1][]{rawlings,#1}%

\begin{document}

\begin{rawlingsbox}[width=\textwidth,colback={white},colbacktitle=red,coltitle=white,colupper=black,title={\textbf{Executive Summary}},title={\textbf{Conclusions}}]
a\\
a\\
a\\
a\\
a\\
a\\
a\\
aa\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
aa\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
aa\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
a\\
\end{rawlingsbox}


\end{document}

答案1

您只需新增所需的breakable選項,如下所示

\tcbset{rawlings/.style={breakable,width=\textwidth,colback={white},colbacktitle=SkyBlue,coltitle=black,colupper=black}}

休息

更新:對於休息後的標題,請添加title after break如下所示

\begin{rawlingsbox}[width=\textwidth,colback={white},colbacktitle=red,coltitle=white,colupper=black,title={\textbf{Conclusions}},title after break={\textbf{Conclusions}}]

更新影像

您確實應該至少閱讀一次文檔,以想像 tcb 的可能性。

相關內容