脚本中的多行标题和图形放置

脚本中的多行标题和图形放置

我正在尝试使用用scrreprt和构建的模板scrpage2,该模板具有多行标题。虽然该headheight选项似乎没有任何效果,但定义topskip效果很好,至少对于文本而言(参见下面结果中的第二页)。但是,当将图形放在页面顶部时,它会被放在标题的下部,即使文本区域中保留了足够的空间。如何使它起作用?

例子:

\documentclass[11pt, headings=small,
    paper=a4,
    pagesize,
    headinclude=true,
    headheight=50mm,   % doesn't seem to have any effect
    footinclude=true]{scrreprt}

\usepackage{lipsum}
\usepackage{fixltx2e}
\usepackage{scrhack}

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

\areaset[current]{165mm}{276mm}
\setlength{\topskip}{20mm}
\makeatletter
\newlength{\my@headwidth}
\setlength{\my@headwidth}{173mm}
\setheadwidth[-2.05mm]{\my@headwidth}

\clearscrheadfoot
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\newcommand{\my@head}{%
    \noindent
    {\large
        \hspace{2.05mm}\raisebox{3mm}{My Organization}
    }
    \\[9mm]
    \noindent
    {further\hfill header\hfill information}
}
\newcommand{\my@page }{Page \thepage{}}
\ihead[\my@head]{\my@head}
\ofoot[\my@page]{\my@page}
\makeatother

\pagestyle{scrheadings}

\begin{document}
  % there is enough space for the figure, but it doesn't seem to care about
  % the topskip
  \begin{figure}
    \includegraphics{demo}
    \caption{Demo}
  \end{figure}
  \lipsum
\end{document}

结果:

答案1

更新

由于 KOMA-Script 版本 3.22 选项areasetadvanced在 KOMA-Script 文档中有说明。如果设置了此选项,则会考虑选项headinclude和。那么示例中就无需使用了。footinclude\areasetgeometry

\documentclass[
  headings=small,
  headlines=5,
  headinclude,
  footinclude,
  areasetadvanced% <- added
]{scrreprt}

\areaset[current]{165mm}{276mm}
\usepackage[demo]{graphicx}
\usepackage[
  headwidth=173mm:-2.05mm,
  manualmark
]
{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\setkomafont{pageheadfoot}{\sffamily\footnotesize}

\ihead*{%
    {\large
      \hspace{2.05mm}\raisebox{3mm}{My Organization}
    }\\[9mm]
    further\hfill header\hfill information
}

\ofoot*{\pagemark}
\renewcommand\pagemark{{\usekomafont{pagenumber}Page\ \thepage}}

\usepackage{lipsum}% for dummy text
\begin{document}
  \begin{figure}
    \includegraphics{demo}
    \caption{Demo}
  \end{figure}
  \the\textheight
  \lipsum
\end{document}

结果:

在此处输入图片描述


原始答案

看起来在重新计算页面布局时\areaset没有注意到该选项。headheight

如果需要特殊的布局,最好使用包geometry

在此处输入图片描述

代码:

\documentclass[
  headings=small,
]{scrreprt}
\usepackage[
  top=7mm,
  bottom=14mm,
  headheight=5\baselineskip,
  includehead,
  includefoot,
  heightrounded,
  textwidth=165mm,
  %showframe% to show the page layout
]{geometry}

\usepackage[demo]{graphicx}
\usepackage[
  headwidth=173mm:-2.05mm,
  manualmark
]
{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\clearpairofpagestyles
\setkomafont{pageheadfoot}{\sffamily\footnotesize}

\ihead*{%
    {\large
      \hspace{2.05mm}\raisebox{3mm}{My Organization}
    }\\[9mm]
    further\hfill header\hfill information
}

\ofoot*{\pagemark}
\renewcommand\pagemark{{\usekomafont{pagenumber}Page\ \thepage}}

\usepackage{lipsum}% for dummy text
\begin{document}
  \begin{figure}
    \includegraphics{demo}
    \caption{Demo}
  \end{figure}
  \the\textheight
  \lipsum
\end{document}

我已从过时的软件包切换scrpage2scrlayer-scrpage。选项 pagesize (自版本 3.17 起)、11ptpaper=a4为默认选项。

相关内容