基线跳过 ohead 吗?

基线跳过 ohead 吗?

我的页眉有 2 行。如何减少行距?

梅威瑟:

% --- Page Layout, Header, Footer --- %
\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage[
  footsepline=0.25pt, headsepline=0.25pt,
  % automark places section title in header. Also enables placement in footer.
  automark]
{scrlayer-scrpage}

\usepackage[a4paper,
  vmargin=2cm, hmargin=2cm, % page margins
  includehead, includefoot, % Margins calculated include header and footer
  footskip=2em]
{geometry}

% Header content
\ohead{{\baselineskip=0pt \tiny{Line1 \\ Line2}}}

\begin{document}
\section{Testing}
\end{document}

答案1

作为一种快速而粗糙的解决方案,您可以添加\baselineskip负数\\

% --- Page Layout, Header, Footer --- %
\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage[
  footsepline=0.25pt, headsepline=0.25pt,
  % automark places section title in header. Also enables placement in footer.
  automark]
{scrlayer-scrpage}

\usepackage[a4paper,
  vmargin=2cm, hmargin=2cm, % page margins
  includehead, includefoot, % Margins calculated include header and footer
  footskip=2em]
{geometry}

% Header content
\ohead{{\tiny Line1 \\[-\baselineskip] Line2}}

\begin{document}
\section{Testing}
\end{document}

在此处输入图片描述

答案2

您可以使用以下表格\ohead

\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage[
  footsepline=0.25pt, headsepline=0.25pt,
  automark]
{scrlayer-scrpage}

\usepackage[
  margin=2cm, % page margins
  includeheadfoot, % Margins calculated include header and footer
  footskip=2em]
{geometry}

% Header content
\ohead{\tiny
  \begin{tabular}{@{}r@{}}
    Line1\\Line2
  \end{tabular}%
}

\begin{document}
\section{Testing}
\end{document}

在此处输入图片描述


或者你可以使用\parbox

% Header content
\ohead{\parbox{\linewidth}{\raggedleft\tiny Line1 \\ Line2}}

另一个建议是将标题的字体大小更改为\tiny

\documentclass[a4paper, oneside, 12pt, parskip=half]{scrartcl}

\usepackage[
  footsepline=0.25pt, headsepline=0.25pt,
  automark]
{scrlayer-scrpage}

\usepackage[
  margin=2cm, % page margins
  includeheadfoot, % Margins calculated include header and footer
  footskip=2em]
{geometry}

% Header content
\ohead{Line1 \\ Line2}
\chead{\normalsize\headmark}
\addtokomafont{pagehead}{\tiny}

\begin{document}
\section{Testing}
\end{document}

相关内容