当使用选项draft
来classicthesis
处理文档时,会显示顶部和底部标尺。但是,几乎在每种情况下,它们的数字都是重复的(有时在从模式切换到final
模式后第一次编译时不会出现deaft
这种情况)。可以以某种方式修复此行为吗?
\documentclass[draft]{scrbook}
\usepackage{blindtext}
\ifdim\overfullrule>0pt
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\usepackage{xcolor}
\AfterPackage*{scrlayer-scrpage}{%
% \DeclareNewLayer[
% head,
% height=0pt,
% foreground,
% contents=\textcolor{gray!70}{\layercontentsmeasure}
% ]{head.ruler}
\DeclareNewLayer[
foot,
height=\textheight+0.1cm,
addvoffset=-\textheight-1.2cm,
background,
contents=\textcolor{lightgray}{\layercontentsmeasure}
]{foot.ruler}
\AddLayersAtBeginOfPageStyle{scrheadings}{foot.ruler}
\AddLayersAtBeginOfPageStyle{plain.scrheadings}{foot.ruler}
\AtBeginDocument{\chead*{DRAFT}\cfoot*{DRAFT}}
}
\fi
\usepackage{classicthesis}
\usepackage{arsclassica}
\usepackage[margin=3cm,heightrounded]{geometry} % just to show bigger rulers
\usepackage{lipsum}% only for dummy text
\begin{document}
\chapter{Chapter one}
\blindtext[5]
\end{document}
编辑#2:下面问题中唯一未解决的问题现在似乎是将数字及其引导线放在 bix 之外,以便可以将其缩小到与 完全相同的大小textarea
。
编辑:现在我几乎设法获得了所需的结果,但我的修改方式非常不专业。我认为需要进行以下更改才能获得最终的改进:
- 显示标尺也是垂直方向的,大致围绕文本块(类似于
showframe
),一边以厘米为单位,另一边以英寸为单位(解决了); - 将数字及其线条放在标尺矩形的外面(这样它们就不会干扰文本或头部/脚部)(未解);
- 在章节(目录等)页面中添加单词“DRAFT”(解决了);
- 将“DRAFT”一词垂直移动到离页面边框更近的地方,这样它就不会干扰文档本身的页眉/页脚(解决了)。
以下是我得到的(部分)结果。
\documentclass[draft]{scrbook}
\usepackage{soulutf8}
\usepackage{ifdraft}
\ifoptiondraft{%
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\PassOptionsToPackage{draft=false}{microtype}
\usepackage{xcolor}
\AfterPackage*{scrlayer-scrpage}{%
\def\myrcoeff{1}
\DeclareNewLayer[
textarea,
addvoffset=\myrcoeff\dimexpr-\headsep\relax,
height=\textheight+\myrcoeff\dimexpr\headsep+\footskip-\footheight\relax,
addhoffset=\myrcoeff\dimexpr-\headsep-.5\footskip+.5\footheight\relax,
width=\textwidth+\myrcoeff\dimexpr+2\headsep+\footskip-\footheight\relax,
background,
contents=\textcolor{lightgray}{\layercontentsmeasure}
]{textarea.ruler}
\AddLayersAtBeginOfPageStyle{scrheadings}{textarea.ruler}
\AddLayersAtBeginOfPageStyle{plain.scrheadings}{textarea.ruler}
\newcommand{\myhfc}{\textcolor{gray}{\textls[667]{DRAFT}}}
\newcommand{\myhfl}{\cleaders\hbox{\,\textcolor{gray}{---}\,}\hfill}
\newcommand{\myhf}[1][1]{\smash{\raisebox{\dimexpr.5\dimexpr#1\headsep+#1\footskip-#1\footheight\relax\relax}{\hbox to \textwidth {\myhfc \myhfl \myhfc \myhfl \myhfc}}}}
\AtBeginDocument{%
\chead*{\myhf}
\cfoot*{\myhf[-1]}%
}%
}%
}{}
\usepackage{classicthesis}
\usepackage{arsclassica}
\usepackage[onehalfspacing]{setspace}
\raggedbottom
\usepackage[margin=3cm,heightrounded]{geometry} % just to show bigger rulers
\usepackage{blindtext} % only for dummy text
%\usepackage{showframe}
\begin{document}
\chapter{Exemplary chapter title}
\blindtext[5]
\end{document}
答案1
选项draft
为图层页面样式的每一层添加标尺。由 定义的页面样式scrlayer-scrpage
由 10 个图层组成,每页使用其中 6 个图层:请参阅使用 scrlayer-scrpage 的“草稿”类/包选项。
draft
即使设置了类选项,为了避免标尺,也传递draft=false
给包选项scrlayer-scrpage
:
\documentclass[draft]{scrbook}
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\usepackage{classicthesis}
\usepackage[margin=3cm]{geometry} % just to show bigger rulers
\usepackage{lipsum}% only for dummy text
\begin{document}
\lipsum[1]
\parbox[t]{\textwidth}{\lipsum[2]}% to see the overfullrule if draft is enabled
\end{document}
你可以用 content 定义自己的图层\layercontentsmeasure
。下面是显示页眉和页脚基线的位置和长度的示例:
\documentclass[draft]{scrbook}
\ifdim\overfullrule>0pt
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\usepackage{xcolor}
\AfterPackage*{scrlayer-scrpage}{%
\DeclareNewLayer[
head,
height=0pt,
foreground,
contents=\textcolor{gray!70}{\layercontentsmeasure}
]{head.ruler}
\DeclareNewLayer[
foot,
height=0pt,
addvoffset=\footheight-\dp\strutbox,
background,
contents=\textcolor{lightgray}{\layercontentsmeasure}
]{foot.ruler}
\AddLayersAtBeginOfPageStyle{scrheadings}{head.ruler,foot.ruler}
\AddLayersAtBeginOfPageStyle{plain.scrheadings}{head.ruler,foot.ruler}
\AtBeginDocument{\chead*{DRAFT}\cfoot*{DRAFT}}
}
\fi
\usepackage{classicthesis}
\usepackage{arsclassica}
\usepackage[margin=3cm]{geometry} % just to show bigger rulers
\usepackage{lipsum}% only for dummy text
\begin{document}
\lipsum[1]
\end{document}
答案2
这是我第一次尝试得到的结果:
\documentclass[draft]{scrbook}
\usepackage{ifdraft}
\ifoptiondraft{%
\PassOptionsToPackage{draft=false}{scrlayer-scrpage}
\usepackage{scrlayer-scrpage}
\usepackage{xcolor}
\newcommand*\showlayer[2][black]{%
\IfLayerAtPageStyle{scrheadings}{#2}{%
\DeclareNewLayer[clone=#2,contents=\textcolor{#1}{\layercontentsmeasure}]{#2.size}%
\AddLayersToPageStyleAfterLayer{scrheadings}{#2.size}{#2}%
}{}%
}
%\showlayer[lightgray]{scrheadings.head.oneside}
\showlayer[red!30]{scrheadings.head.below.line}
%\showlayer[green!30]{scrheadings.head.above.line}
%\showlayer[lightgray]{scrheadings.foot.oneside}
\showlayer[red!30]{scrheadings.foot.above.line}%
%\showlayer[green!30]{scrheadings.foot.below line}%
}{}
\usepackage{classicthesis}
\usepackage{arsclassica}
\ifoptiondraft{%
\chead{DRAFT}
\cfoot{DRAFT}%
}{}
\usepackage[margin=3cm]{geometry} % just to show bigger rulers
\begin{document}
Text.
\end{document}