如何让页眉、章节标题和图形扩展到页边距?

如何让页眉、章节标题和图形扩展到页边距?

我对以下页面布局感兴趣。

  1. 如何在页边距中添加页眉(最多到页边距)
  2. 是否可以从页边距开始章节标题
  3. 如何设置图形占据的边距。

我可以制作如下所示的 MWE

    \documentclass[12pt,a4paper]{scrbook}

\usepackage[demo]{graphicx}

\usepackage[calcwidth]{titlesec}

%\titleformat{\section}[leftmargin]
%{\normalfont
%\sffamily\bfseries\filleft}
%{}{0pt}{}
%\titlespacing{\section}
%{4pc}{1.5ex plus .1ex minus .2ex}{1pc}

\newlength\mylen
\setlength\mylen{\dimexpr\oddsidemargin+1in+\hoffset\relax}

\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\llap{\hspace*{-\mylen}\thesection\hfill}}{0em}{}
  [{\makebox[\linewidth][l]{%
    \hspace*{-\mylen}\rule{\dimexpr\textwidth+\mylen\relax}{1pt}}}]

%titleps is alternate for fancyhdr
%
\usepackage{titleps}

%\newpagestyle{main}[\small\sffamily]{
\newpagestyle{main}{
\widenhead[4pc][0pt]{4pc}{0pt} %for scrbook
%\widenhead[6pc][0pt]{0pt}{6pc} %for scrbook
%\widenhead[0pt][6pc]{6pc}{0pt} %for scrartcl
\headrule
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{\textsl{\chaptertitle}}
{\textbf{\thepage}}
}
\pagestyle{main}

\renewpagestyle{plain}[\small\sffamily]{
%\footrule
%\setfoot[\textbf{\thepage}]
\setfoot
[]
[]
[]
{}
{}
%{\textbf{\thepage}}
{}
%
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{}
{\textbf{\thepage}}
}



\begin{document}

\chapter{Chapter title}

\clearpage

\section{Section title}


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf

\section{ Section title}

%
\begin{figure}[hb]
%\centering
\includegraphics[width=0.2\linewidth]{}
%\label{fig:p6a}
\caption{Figure caption}
\end{figure}
%


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

\clearpage

\section{title}
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf    

\end{document}

输出:偶数页 在此处输入图片描述

奇数页 在此处输入图片描述

我想将图形位置改为边距......

可能的解决方案 将图表并排摆放,溢出到外边距

答案1

此次修复包括几点:

1)\usepackage{calc}

2)新的标题定义使其左对齐:

\newcommand\mycaption[1]{\caption{%
  \leftskip-\mylen#1\protect\rule{\textwidth-\mylen}{0in}}}

3)\leftskip图形环境的边距

\begin{figure}[hb]
\setlength\leftskip{\leftskip-\mylen}
\includegraphics[width=0.2\linewidth]{}
\mycaption{Figure caption}
\end{figure}

警告:我没有修复第 3 页上现有的边距问题。

\documentclass[12pt,a4paper]{scrbook}

\usepackage[demo]{graphicx}
\usepackage{calc}

\usepackage[calcwidth]{titlesec}

%\titleformat{\section}[leftmargin]
%{\normalfont
%\sffamily\bfseries\filleft}
%{}{0pt}{}
%\titlespacing{\section}
%{4pc}{1.5ex plus .1ex minus .2ex}{1pc}

\newlength\mylen
\setlength\mylen{\dimexpr\oddsidemargin+1in+\hoffset\relax}

\titleformat{\section}
  {\normalfont\Large\bfseries}
  {\llap{\hspace*{-\mylen}\thesection\hfill}}{0em}{}
  [{\makebox[\linewidth][l]{%
    \hspace*{-\mylen}\rule{\dimexpr\textwidth+\mylen\relax}{1pt}}}]

%titleps is alternate for fancyhdr
%
\usepackage{titleps}

%\newpagestyle{main}[\small\sffamily]{
\newpagestyle{main}{
\widenhead[4pc][0pt]{4pc}{0pt} %for scrbook
%\widenhead[6pc][0pt]{0pt}{6pc} %for scrbook
%\widenhead[0pt][6pc]{6pc}{0pt} %for scrartcl
\headrule
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{\textsl{\chaptertitle}}
{\textbf{\thepage}}
}
\pagestyle{main}

\renewpagestyle{plain}[\small\sffamily]{
%\footrule
%\setfoot[\textbf{\thepage}]
\setfoot
[]
[]
[]
{}
{}
%{\textbf{\thepage}}
{}
%
\sethead
[\textbf{\thepage}]
[\textsl{Title of the Book}]
[]
{}
{}
{\textbf{\thepage}}
}



\begin{document}

\chapter{Chapter title}

\clearpage

\section{Section title}


skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf

\section{ Section title}

\newcommand\mycaption[1]{\caption{%
  \leftskip-\mylen#1\protect\rule{\textwidth-\mylen}{0in}}}
%
\begin{figure}[hb]
\setlength\leftskip{\leftskip-\mylen}
%\centering
\includegraphics[width=0.2\linewidth]{}
%\label{fig:p6a}
\mycaption{Figure caption}
\end{figure}
%

skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk

\clearpage

\section{title}
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf skjdfh jhsdf sdfk
sdfsdf    

\end{document}

在此处输入图片描述

相关内容