tcolorbox
为什么垂直相对于文本主体没有居中?如何补救?
PS1: 指定的标尺怎么不\DeclareNewLayer
显示?
PS2:这是“禁用显示\chapter
”。如您所见,我完全放弃了\chapter
(不要介意章节计数器、目录等,我稍后会处理它们)。
PS3:不均匀的空间不是由于tcoloborbox
页脚造成的,因此有了新标题。还添加了网格。
\documentclass{report}
\usepackage[inline,shortlabels]{enumitem}
\usepackage{fontawesome}
\usepackage{lastpage}
\usepackage{lipsum}
\usepackage{xparse}
% Read PS3:
\usepackage[grid,
gridcolor=red!20,
subgridcolor=green!20,
gridunit=in]{eso-pic}
% geometry---------------------------------------------------------
\usepackage[
paper=a6paper,
layout=a6paper,
centering,
left=7em, % fat margins only to better inspect the flaw
right=7em,
top=7em,
bottom=7em,
showframe
]{geometry}
\savegeometry{default}
\savegeometry{default}
%\loadgeometry{default}
%tabularx--------------------------------------------------------------
\usepackage{tabularx}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\NewDocumentCommand{\thedoc}
{}% Is there not a command for `token list` in xparse?
{THIS DOC}
\NewDocumentCommand{\myheaderii}
{+mm}
{%
\begin{tabularx}{\textwidth}{@{}XR@{}}#1\end{tabularx}
}
\NewDocumentCommand{\myheaderiii}
{+mmm}
{%
\begin{tabularx}{\textwidth}{@{}X@{}C@{}R@{}}#1\end{tabularx}
}
\NewDocumentCommand{\chapterMark}{}{UNDEFINED!}
\NewDocumentCommand{\setchapterMark}{m}
{%
\RenewDocumentCommand{\chapterMark}{}{#1}
}
%\setcounter{chapter}{0}
\NewDocumentCommand{\newChapter}{
m % chapter title
m % chapter mark
+m % chapter content
}
{%
\setchapterMark{#2}
\thispagestyle{specialii}
\begin{tcolorbox}[
title=\noindent\myheaderii{\bfseries#1}{\chapterMark}]
#3
\end{tcolorbox}
}
%tcolorbox--------------------------------------------------------
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\tcbset{breakable}
%pagestyle--------------------------------------------------------
\usepackage{titleps}
\newpagestyle{specialii}
{
\setfoot{%
\myheaderii{\thedoc}{\thepage/\pageref{LastPage}}%
}{}{}
}
\newpagestyle{specialiii}
{
\setfoot{%
\myheaderiii{\thedoc}{\chapterMark}{\thepage/\pageref{LastPage}}%
}{}{}
}
% https://tex.stackexchange.com/questions/318809/place-a-ruler-somewhere-on-a-page
% TODO:
\usepackage{scrlayer}
\DeclareNewLayer[
foreground,
innermargin,
contents=\layercontentsmeasure
]{measurelayer}
\DeclareNewPageStyleByLayers{measurestyle}{measurelayer}
\usepackage{hyperref}
\begin{document}
\pagestyle{specialiii}
\begin{titlepage}\vspace*{\fill}\huge\begin{center}\thedoc\end{center}\vspace*{\fill}\end{titlepage}
%\loadgeometry{default}
\vspace*{\fill}
\newChapter{Fonts}{\faFont}{%
\lipsum[1][1]
\begin{enumerate}[(i), leftmargin=2em]
\item \lipsum[1][2]
\end{enumerate}
\lipsum[1][3]
\begin{enumerate}[(i), leftmargin=2em]
\item \lipsum[1][4]
\item \lipsum[1][5]
\end{enumerate}
%\lipsum[1][5]
% \begin{enumerate}[(i), leftmargin=2em]
%\item \lipsum[1][6]
%\item \lipsum[1][7]
%\end{enumerate}
%
%\lipsum[1][8]
%\begin{enumerate}[(i), leftmargin=2em]
% \item \lipsum[1][9]
% \end{enumerate}
}
\vspace*{\fill}
\end{document}
答案1
\vspace{\baselineskip}
在第二个之后添加,\vspace*{\fill}
在不同设置下都可以完成工作。我不知道为什么首先需要这样做。