ConTeXt 中重新定义头前的空白不起作用

ConTeXt 中重新定义头前的空白不起作用

正如您在下面的代码中看到的,我试图在重新定义的头部前放置一些空白,但如网格所示,没有显示任何空白。

\setuppapersize[A5]

\setupindenting[always,small,first]

% Chapters
\define[2]\CustomChapter{\dontleavehmode\framed[frame=off,width=broad,align=center]{#1.\\#2}}

\setuphead [chapter] [after=\blank[2*line]},before{\blank[line]},command=\CustomChapter]

% Author's note and closing should have a blank line before title and two after
\setuphead [title] [after={\blank[2*line]},before{\blank[2*line]},command=,align=middle,incrementnumber=list]

\showgrid

\starttext

% Author note
\starttitle[title={AUTHOR'S NOTE}]This is a note from the author.\stoptitle

% Chapters with Prologue and Epilogue
\starttitle[title={Prologue}]This is the Prologue.\stoptitle
\startchapter[title={One}]This is Chapter One.\stopchapter
\startchapter[title={Two}]This is Chapter Two\stopchapter
\starttitle[title={Epilogue}]This is the epilogue\stoptitle

% Closing Comments
\starttitle[title={CLOSING COMMENTS}]These are closing comments.\stoptitle

% Table of contents
\setupheadtext[content=CONTENTS]
\completecontent[criterium=previous]

\stoptext

答案1

您的代码中有拼写错误。正确的语法是before={\blank[...]}(您的代码中=缺少)。

但更重要的是,TeX 会忽略页面顶部的内容\vskip(这是\blank内部内容)。要获取页面顶部的空白,请使用\blank[force,line]etc.(即添加关键字force)。这是一个最简单的示例:

\setuppapersize[A5]

\setupindenting[always,small,first]

\setuphead
    [chapter]
    [
      after={\blank[2*line]},
      before={\blank[force,line]},
    ]

\setuphead
  [title]
  [
    after={\blank[2*line]},
    before={\blank[force,2*line]},
  ]


\showgrid

\starttext

% Author note
\starttitle[title={AUTHOR'S NOTE}]This is a note from the author.\stoptitle

% Chapters with Prologue and Epilogue
\starttitle[title={Prologue}]This is the Prologue.\stoptitle
\startchapter[title={One}]This is Chapter One.\stopchapter
\startchapter[title={Two}]This is Chapter Two\stopchapter
\starttitle[title={Epilogue}]This is the epilogue\stoptitle

% Closing Comments
\starttitle[title={CLOSING COMMENTS}]These are closing comments.\stoptitle

% Table of contents
\setupheadtext[content=CONTENTS]
\completecontent[criterium=previous]

\stoptext

相关内容