我正在使用 KOMA 脚本srcbook
类,我的计划是在每个文本部分下方都有文本和水平线以供书写。
例如
\chapter{1}
this is a sentence
\oneline
etc.
其中\oneline
定义为
\newcommand{\oneline}{
\vspace{0.6cm}
\hrule
\vspace{0.3cm}
}
这种方法有很多问题。我不能使用脚注(因为水平线会被切断),而且水平线会流到下一页。
有没有一种简单的方法可以在文本下方创建一条水平线,以使其不会流入下一页,或者至少使文本和水平线组合在一起?
我知道浮点数可用于包含图形,这是一个好的方法吗?
答案1
只需使用\nobreak
:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\newcommand*{\oneline}{%
\par\nobreak\vspace{6mm}%
\hrule
\nobreak\vspace{3mm}%
}
\begin{document}
Let's skip to the bottom of the page:
\vspace{543pt} % then try incrementing this to 544pt
Some text.
\oneline
Some other text.
\end{document}
添加:让\oneline
宏在行间粘合方面也“稳定”也许是个好主意。在这种情况下,您可能希望将垂直间距(6mm,3mm)减少到较小的值。
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\newcommand*{\oneline}{%
\vskip -\prevdepth
\par\nobreak\vskip 6mm
\hrule
\nobreak\vskip 3mm \relax
\setlength\prevdepth{0pt}%
}
\begin{document}
Let's skip to the bottom of the page:
\vspace{537pt} % then try incrementing this to 538pt
Some text, with descenders: fgjpqy.
\oneline
Some other text.
\showboxbreadth = 1000
\showboxdepth = 10
\showlists
\end{document}