如何调整 ConTeXt 页脚区域中的页码位置?

如何调整 ConTeXt 页脚区域中的页码位置?

我想将 ConTeXt 中下面 MWE 页脚区域中页码的位置稍微提升一点:

平均能量损失

\setuppapersize [A4]

\setuplayout
  [header=0pt,
    margin=0pt,
    footerdistance=0cm,
    topspace=1cm,
    backspace=1cm,
    width=fit,
    height=\dimexpr\paperheight-\topspace+\footerheight+\footerdistance-2.3cm\relax]

\showframe
\showlayout
\showsetups


\setuppagenumbering [location={footer,middle}]
\setupfootertexts[{Page \pagenumber{} of \totalnumberofpages}]


\starttext
This is just a minimal working example to show the location of the page numbers in the footnote area.

\stoptext


%%% local Variables:
%%% mode: context
%%% TeX-master: t
%%% TeX-engine: luatex
%%% End:

输出

在此处输入图片描述

在 latex 中,我曾经使用命令 来实现类似功能\raisebox{0.6\baselineskip}{SomeTextToAdjust}。那么在 ConTeXt 中,在页脚区域增加页码的并行方法是什么?

答案1

我认为它们是回答你问题的更直接的方式,但是维基百科检查建议我这个答案

\setuppapersize [A4]

\setuplayout
  [header=0pt,
   margin=0pt,
   footerdistance=0cm,
   topspace=1cm,
   backspace=1cm,
   width=fit,
   height=\dimexpr\paperheight-\topspace+\footerheight+\footerdistance-2.3cm\relax]

\startsetups[headertext]
  \startframed[frame=off,height=5ex,align={middle,lohi},width=fit]
    Page \pagenumber{} of \totalnumberofpages
  \stopframed
\stopsetups

\setupfootertexts[\directsetup{headertext}]
\showframe
\showlayout
\showsetups


%\setuppagenumbering [location={footer,middle}]
%\setupfootertexts[{Page \pagenumber{} of \totalnumberofpages}]


\starttext
This is just a minimal working example to show the location of the page numbers in the footnote area.

\stoptext

如您所见,调整框架高度可以为您提供一些备用空间,因为我们将内容置于框架内的中心。当然,这样做的副作用是,您在文本上方也留有备用空间……

带有 5ex 高度 lohi 框架的页脚

答案2

您可以只提高整个页脚区域。

\setuppapersize [A4]

\setuplayout
  [%horizontal
    margin=0pt,
    backspace=1cm,
    width=fit,
    %vertical
    topspace=1cm,
    header=0pt,
    height=fit,
    footerdistance=0cm,
    bottomspace=1cm]

\showframe
\showlayout
\showsetups


\setuppagenumbering [location={footer,middle}]
\setupfootertexts[{Page \pagenumber{} of \totalnumberofpages}]


\starttext

This is just a minimal working example to show the location of the page numbers in the footnote area.

\stoptext

在此处输入图片描述

答案3

当页脚文本太低且所有页面都如此时,最好的解决方案是更改页面布局以将页脚区域向上模式化,这可以通过降低文本块的高度来实现。

如果您不想更改布局,可以将页脚的内容放在框架中,并更改底部的偏移值。要确保框架填满整个页脚区域,您可以使用 禁用该strut设置\setupfooter

\setuppapersize [A4]

\setuplayout
  [backspace=1cm,
   width=middle,
   header=0pt,
   topspace=1cm,
   bottomspace=0.5cm,
   height=middle]

\showframe [text,footer] [text]

\setuppagenumbering
  [location=none]

\setupfooter
  [strut=no]

% \setupfootertexts
%   [{\framed
%       [frame=off,width=max,height=max,align={middle,low},offset=0pt,boffset=5mm]
%       {Page \realpagenumber\ of \lastrealpagenumber}}]

\setupfootertexts
  [{\framed
      [frame=off,width=max,height=max,align={middle,low},offset=0pt,boffset=5mm]
      {Page \realpagenumber\ of \lastrealpagenumber}}]

\starttext
This is just a minimal working example to show the location of the page numbers in the footnote area.
\stoptext

在此处输入图片描述

相关内容