我想创建这个布局:
标题在黑框中,使用titlesec
。但我只得到了这个结果:
我无法向下移动页码...
这是我的代码:
\documentclass{book}
\usepackage[a4paper,right=1cm, left=1cm,bottom=1cm,top=1cm]{geometry}
\pagestyle{plain}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\pagestyle{plain}
\renewpagestyle{plain}{
\widenhead[1cm][1cm]{1.5cm}{1.5cm}
\sethead[\LARGE\bfseries\thepage][][]{}{}{\LARGE\bfseries\thepage}%
}
\newpagestyle{main}{
\widenhead[1cm][1cm]{1.5cm}{1.5cm}
\sethead[\LARGE\bfseries\thepage][][]{}{}{\LARGE\bfseries\thepage}%
}
\begin{document}
\pagestyle{main}
\chapter{Here}
\section{here}
\lipsum[1-20]
\chapter{Here}
\lipsum[1-20]
\end{document}
我尝试用 来解决问题background
,但无法阻止它遇到空白页和章节(普通)页。
答案1
可能的解决方案:
\documentclass{book}
\usepackage[a4paper,right=1cm, left=1cm,bottom=1cm,top=1cm]{geometry}
\pagestyle{plain}
\usepackage[pagestyles]{titlesec}
\usepackage[]{graphicx}
\usepackage{lipsum}
\pagestyle{plain}
\newcommand*\MoveA[2]
{%
\rlap
{%
\raisebox{-\dimexpr\headsep+\height\relax}
{%
\llap
{%
\begin{tabular}[t]{@{}c@{}}
#1\\[\medskipamount]
#2
\end{tabular}%
}%
}%
}%
}
\newcommand*\MoveB[2]
{%
\rlap
{%
\raisebox{-\dimexpr\headsep+\height\relax}
{%
\rlap
{%
\begin{tabular}[t]{@{}c@{}}
#1\\[\medskipamount]
#2
\end{tabular}%
}%
}%
}%
}
\newcommand*\OutputHeadmark
{%
\rotatebox{90}{\strut\chaptertitle}%
}
\newcommand*\MyHeadStyle
{%
\LARGE\bfseries
}
\renewpagestyle{plain}
{%
\sethead[\MyHeadStyle\MoveA{\thepage}{\OutputHeadmark}][][]
{}{}{\MyHeadStyle\MoveB{\thepage}{\OutputHeadmark}}%
}
\newpagestyle{main}
{%
\sethead[\MyHeadStyle\MoveA{\thepage}{\OutputHeadmark}][][]
{}{}{\MyHeadStyle\MoveB{\thepage}{\OutputHeadmark}}%
}
\begin{document}
\pagestyle{main}
\chapter{Here}
\section{here}
\lipsum[1-20]
\chapter{There}
\lipsum[1-20]
\lipsum[1-20]
\end{document}