
Я разрабатываю лист упражнений и мне нужна помощь с заголовком. Он выглядит так, как и должно быть с моим кодом, но находится слишком высоко на странице. Изменение headheight
не дает никакого эффекта, только LaTeX жалуется, если я выбираю его слишком низко.
Есть ли способ разместить его ниже на странице? Или мне нужно сделать двухстрочный заголовок другим способом?
Кроме того, я хотел бы узнать, есть ли простая возможность отображать заголовок только на тех страницах, где начинается новый раздел, а не на других страницах (например, на первых двух страницах, но не на последней в примере).
\documentclass[paper=a4, twoside=true, fontsize=11pt, parskip=half, headheight=1cm, DIV=12]{scrartcl}
% Designing the head of the page
\usepackage[automark,headsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\ihead{{\normalfont\bfseries Exercise Sheet \thesection\ for some Lecture, Summer 2015}\\
\normalfont Due date: Thursday, 01. January 2015, 10:00}
\ohead{{\normalfont\bfseries Prof. Dr. John Doe}\\
\normalfont [email protected]}
\chead{}
\usepackage{blindtext}
\begin{document}
\blinddocument
\end{document}
решение1
Возможно, вы ищете headinclude=true
опцию. Вы можете задать эту опцию явно \documentclass[...,headinclude=true,...]{scrartcl}
. Или вы можете задать headsepline
опцию как опцию класса. Тогда headinclude=true
она будет установлена автоматически.
Если заголовок должен быть только в случае, если раздел начинается на странице, используйте pagestyle plain
и переключитесь на scrheadings
использование \thispagestyle{scrheadings}
после \section
команды
\documentclass[
twoside=true,
parskip=half,
headlines=2,
headsepline,% headinclude=true is also set
DIV=12
]{scrartcl}
% Designing the head of the page
\usepackage[
%automark,% why? \headmark etc. are not used in your code
%headsepline
]{scrlayer-scrpage}
\ihead{\textbf{Exercise Sheet \thesection\ for some Lecture, Summer 2015}\\
Due date: Thursday, 01. January 2015, 10:00}
\ohead{\textbf{Prof. Dr. John Doe}\\
[email protected]}
\chead{}
\setkomafont{pagehead}{\normalfont}
\pagestyle{plain}
\usepackage{blindtext}
\begin{document}
\section{First section}\thispagestyle{scrheadings}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\section{Second section}\thispagestyle{scrheadings}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\end{document}
В качестве альтернативы вы можете загрузить команду etoolbox
для исправления\section
\documentclass[
twoside=true,
parskip=half,
headlines=2,
headsepline,% headinclude=true is also set
DIV=12
]{scrartcl}
% Designing the head of the page
\usepackage[
%automark,% why? you define the header manually in your code
%headsepline
]{scrlayer-scrpage}
\ihead{\textbf{Exercise Sheet \thesection\ for some Lecture, Summer 2015}\\
Due date: Thursday, 01. January 2015, 10:00}
\ohead{\textbf{Prof. Dr. John Doe}\\
[email protected]}
\chead{}
\setkomafont{pagehead}{\normalfont}
\pagestyle{plain}
\usepackage{etoolbox}
\pretocmd\section{\thispagestyle{scrheadings}}{}{}
\usepackage{blindtext}
\begin{document}
\section{First section}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\section{Second section}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\end{document}
решение2
Ну, у KOMA-Script есть свой собственный алгоритм для построения или более точного расчета области печати.
Например, вы использовали DIV=12
. В руководстве KOMA-Script вы можете прочитать, как это работает. Здесь только это: При большем числе (например 12
) у вас будут меньшие поля с KOMA-Script. Если вам нужны большие поля, используйте меньшее число для DIV, например DIV=9
.
Чтобы визуализировать это, я добавил пакет showframe
в свой MWE, чтобы обозначить область ввода для вас. Попробуйте мой MWE с несколькими числами для DIV
. Затем измените размер шрифта и попробуйте снова с несколькими DIV. Вы увидите разницу.
Если вы хотите использовать специальные поля, рассмотрите возможность использования пакета geometry
.
MWE с небольшой красивой печатью для тестирования:
\documentclass[%
paper=a4
%,twoside=true % why for an article??????????????
,fontsize=11pt % relevant for typing area
,parskip=half
,headheight=28pt % 28pt minimum; depends on fontsize
,DIV=9 % relevant for typing area: try 9, 10, 11, 12
]{scrartcl}
\usepackage{blindtext} % for dummy text
\usepackage{showframe} % shows typing area
% Designing the head of the page
\usepackage[%
automark
,headsepline
]{scrlayer-scrpage}
\pagestyle{scrheadings}
\ihead{{\normalfont\bfseries Exercise Sheet \thesection\ for some Lecture, Summer 2015}\\
\normalfont Due date: Thursday, 01. January 2015, 10:00}
\ohead{{\normalfont\bfseries Prof. Dr. John Doe}\\
\normalfont [email protected]}
\chead{}
\begin{document}
\blinddocument
\thispagestyle{empty}
\blindtext
\end{document}
Если вы не хотите, чтобы на странице отображался верхний колонтитул, вы можете использовать команду, \thispagestyle{empty}
показанную в последних двух строках MWE.