我需要将 \vrule 的高度设置为页面上实际文本的高度,而不是文本区域的完整高度。在下图中,线条延伸到文本之外,但应该停止在文本的底部。
这些线条是通过以下代码生成的:
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper,13pt]{memoir}
\usepackage{xparse}
\usepackage{microtype}
\usepackage{lettrine}
\usepackage{eso-pic}
\usepackage{multicol}
\settypeblocksize{9.5in}{6.1in}{*}
\setlrmargins{*}{*}{0.85}
\checkandfixthelayout
\usepackage{fontspec,xltxtra,xunicode}
\setromanfont[Mapping=tex-text]{Phetsarath OT}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Phetsarath OT}
\setmonofont[Scale=MatchLowercase]{Phetsarath OT}
\setlength{\headheight}{14pt}
\setlength{\parindent}{0em}
% set up ordinary footnotes
\makeatletter
\def\footnoterule{\kern-3\p@
\hrule \@width \textwidth \kern 2.6\p@}
\makeatother
\renewcommand\thefootnote{\textit{\arabic{footnote}}}
% code to create chapters, verses, and cross references
\ExplSyntaxOn
\int_new:N \crossref_int
\int_new:N \vs_int
\tl_new:N \crossref_tl
% insert a cross reference
\NewDocumentCommand {\crossref} {m}
{
\int_compare:nNnT { \crossref_int } > { 25 }
{
\int_set:Nn \crossref_int { 0 }
}
\int_incr:N \crossref_int
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \textsuperscript{ \emph { \int_to_alph:n { \crossref_int } } }
\tl_if_empty:NF \crossref_tl
{
\tl_gput_right:Nn \emph { \crossref_tl { ~ } }
}
\tl_gput_right:Nx \crossref_tl
{
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \exp_not:N \textsuperscript
% {
% \exp_not:N \emph { \int_to_alph:n { \crossref_int } }
% }
\, #1
}
}
%Sample output
% insert chapter marker
\NewDocumentCommand {\ch} {m}
{
\int_gset:Nn \vs_int {1}
\lettrine [findent=0.5em,nindent=0em] { #1 } {}
}
% output cross references from previous verse and insert verse marker
\NewDocumentCommand {\vs} {m}
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
\int_gset:Nn \vs_int { #1 }
\tl_gclear:N \crossref_tl
%\textsuperscript { #1 \, }
%\textbf { #1 \, }
\par\textbf{\large{\textsuperscript{#1 \, }}}
}
% output any remaining cross references
\AtEndDocument
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
}
\ExplSyntaxOff
% set up centre column location and size
\setlength\columnsep{2.2cm}
\setlength{\sidebarhsep}{\dimexpr -0.5\textwidth - 0.5\columnsep + 2mm}
\setlength{\sidebarwidth}{\dimexpr \columnsep - 4mm}
\sidebarmargin{left}
\renewcommand{\sidebarfont}{\footnotesize\normalfont}
\renewcommand*{\sidebarform}{\raggedright\hangindent 1mm}
\setlength{\sidebarvsep}{0ex}
\setsidebarheight{\dimexpr \textheight - 1ex}
% add vertical lines
\AddToShipoutPictureBG{%
\AtTextUpperLeft{%
\hskip \dimexpr 0.5\textwidth - 0.5\columnsep + 1mm
\vrule depth \dimexpr \textheight - \ht\strutbox - 1pt
\hskip \dimexpr\columnsep - 2mm
\vrule depth \dimexpr \textheight - \ht\strutbox - 1pt}}
\begin{document}
\begin{multicols}{2}
\ch{1}\crossref{John\ 1:1; [Col.\ 1:17; 1 John 1:1; Rev. 1:4, 8, 17; 3:14;
21:6; 22:13]}In the beginning was \crossref{Rev.\ 19:13; [Heb.\ 4:12; 1 John
1:1]}the Word, and \crossref{1 John 1:2; [ch.\ 17:5]}the Word was with God,
and \crossref{Phil.\ 2:6}the Word was God. \vs{2}He was in the beginning
with God. \vs{3}\crossref{ver.\ 10; Ps.\ 33:6; 1 Cor.\ 8:6; Col.\ 1:16;
Heb.\ 1:2}All things were made through him, and without him was not any
thing made that was made. \vs{4}\crossref{ch.\ 5:26; 11:25; 1 John 1:2;
5:11}In him was life,\footnote{Or \emph{was not any thing made. That which
has been made was life in him}} and \crossref{ch.\ 8:12; 9:5; 12:46}the life
was the light of men. \vs{5}\crossref{[ch.\ 3:19]}The light shines in the
darkness, and the darkness has not overcome it.
\end{multicols}
[REST OF DOCUMENT TRUNCATED]
\end{document}
我考虑过的一些选项包括尝试使用\settoheight{}
、尝试使用\strut
或尝试tikz
在绘制 之前进行一些高度计算\vrule
。我尝试过的所有方法都没有帮助,尽管我可能没有正确实施。
事情稍微复杂一点,有些页面的脚注上方可能有一条水平线。垂直线不得与水平线交叉,如下图所示,但如果文本在脚注的一定距离内停止,则垂直线可能会与水平线相交。
有没有办法指定实际的文本高度与此类似\textheight
?如何才能最好地解决这个问题?
答案1
当您手头有文本时添加规则可能比稍后在发货挂钩中添加规则更容易。
这只是修改了回忆录的旁注栏以使其具有规则
\documentclass[a4paper,13pt]{memoir}
\usepackage{xparse}
\usepackage{microtype}
\usepackage{lettrine}
\usepackage{eso-pic}
\usepackage{multicol}
\makeatletter
\renewcommand{\sidecontents}{\hbox to \z@{%
\m@mwhich@margin{\m@msidebar@margin}%
\ifmemtortm
\m@sideb@right
\else
\m@sideb@left
\fi
\@tempdima=\dimexpr\ht\sideins+\dp\sideins\relax
\smash{\vrule depth \@tempdima}%
\vtop to0pt{%
\normalsize\normalfont\sidebarfont% select font so we know the strut size
\vskip\topskip \vskip-\ht\strutbox
\vskip\sidebartopsep% extra vertical shift
\unvbox\sideins \vss}%
\smash{\vrule depth \@tempdima}%
\hss}%
}
\makeatother
\settypeblocksize{9.5in}{6.1in}{*}
\setlrmargins{*}{*}{0.85}
\checkandfixthelayout
\usepackage{fontspec} % don't use these in almost all cases ,xltxtra,xunicode}
%\setromanfont[Mapping=tex-text]{Phetsarath OT}
%\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Phetsarath OT}
%\setmonofont[Scale=MatchLowercase]{Phetsarath OT}
\setlength{\headheight}{14pt}
\setlength{\parindent}{0em}
% set up ordinary footnotes
\makeatletter
\def\footnoterule{\kern-3\p@
\hrule \@width \textwidth \kern 2.6\p@}
\makeatother
\renewcommand\thefootnote{\textit{\arabic{footnote}}}
% code to create chapters, verses, and cross references
\ExplSyntaxOn
\int_new:N \crossref_int
\int_new:N \vs_int
\tl_new:N \crossref_tl
% insert a cross reference
\NewDocumentCommand {\crossref} {m}
{
\int_compare:nNnT { \crossref_int } > { 25 }
{
\int_set:Nn \crossref_int { 0 }
}
\int_incr:N \crossref_int
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \textsuperscript{ \emph { \int_to_alph:n { \crossref_int } } }
\tl_if_empty:NF \crossref_tl
{
\tl_gput_right:Nn \emph { \crossref_tl { ~ } }
}
\tl_gput_right:Nx \crossref_tl
{
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \exp_not:N \textsuperscript
% {
% \exp_not:N \emph { \int_to_alph:n { \crossref_int } }
% }
\, #1
}
}
%Sample output
% insert chapter marker
\NewDocumentCommand {\ch} {m}
{
\int_gset:Nn \vs_int {1}
\lettrine [findent=0.5em,nindent=0em] { #1 } {}
}
% output cross references from previous verse and insert verse marker
\NewDocumentCommand {\vs} {m}
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
\int_gset:Nn \vs_int { #1 }
\tl_gclear:N \crossref_tl
%\textsuperscript { #1 \, }
%\textbf { #1 \, }
\par\textbf{\large{\textsuperscript{#1 \, }}}
}
% output any remaining cross references
\AtEndDocument
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
}
\ExplSyntaxOff
% set up centre column location and size
\setlength\columnsep{2.2cm}
\setlength{\sidebarhsep}{\dimexpr -0.5\textwidth - 0.5\columnsep + 2mm}
\setlength{\sidebarwidth}{\dimexpr \columnsep - 4mm}
\sidebarmargin{left}
\renewcommand{\sidebarfont}{\footnotesize\normalfont}
\renewcommand*{\sidebarform}{\raggedright\hangindent 1mm}
\setlength{\sidebarvsep}{0ex}
\setsidebarheight{\dimexpr \textheight - 1ex}
% add vertical lines
\iffalse
\AddToShipoutPictureBG{%
\AtTextUpperLeft{%
\hskip \dimexpr 0.5\textwidth - 0.5\columnsep + 1mm
\vrule depth \dimexpr \textheight - \ht\strutbox - 1pt
\hskip \dimexpr\columnsep - 2mm
\vrule depth \dimexpr \textheight - \ht\strutbox - 1pt}}
\fi
\begin{document}
\begin{multicols}{2}
\ch{1}\crossref{John\ 1:1; [Col.\ 1:17; 1 John 1:1; Rev. 1:4, 8, 17; 3:14;
21:6; 22:13]}In the beginning was \crossref{Rev.\ 19:13; [Heb.\ 4:12; 1 John
1:1]}the Word, and \crossref{1 John 1:2; [ch.\ 17:5]}the Word was with God,
and \crossref{Phil.\ 2:6}the Word was God. \vs{2}He was in the beginning
with God. \vs{3}\crossref{ver.\ 10; Ps.\ 33:6; 1 Cor.\ 8:6; Col.\ 1:16;
Heb.\ 1:2}All things were made through him, and without him was not any
thing made that was made. \vs{4}\crossref{ch.\ 5:26; 11:25; 1 John 1:2;
5:11}In him was life,\footnote{Or \emph{was not any thing made. That which
has been made was life in him}} and \crossref{ch.\ 8:12; 9:5; 12:46}the life
was the light of men. \vs{5}\crossref{[ch.\ 3:19]}The light shines in the
darkness, and the darkness has not overcome it.
\end{multicols}
[REST OF DOCUMENT TRUNCATED]
\end{document}
或者您可以multicols
在列之间添加两个规则,而不是一个:
\documentclass[a4paper,13pt]{memoir}
\usepackage{xparse}
\usepackage{microtype}
\usepackage{lettrine}
\usepackage{eso-pic}
\usepackage{multicol}
\makeatletter
% plan a
% \renewcommand{\sidecontents}{\hbox to \z@{%
% \m@mwhich@margin{\m@msidebar@margin}%
% \ifmemtortm
% \m@sideb@right
% \else
% \m@sideb@left
% \fi
% \@tempdima=\dimexpr\ht\sideins+\dp\sideins\relax
% \smash{\vrule depth \@tempdima}%
% \vtop to0pt{%
% \normalsize\normalfont\sidebarfont% select font so we know the strut size
% \vskip\topskip \vskip-\ht\strutbox
% \vskip\sidebartopsep% extra vertical shift
% \unvbox\sideins \vss}%
% \smash{\vrule depth \@tempdima}%
% \hss}%
% }
% plan b make multicol add two rules
\setlength\columnseprule{1pt}
\def\LR@column@boxes{%
\process@cols\mult@gfirstbox{%
\ifdim\dp\count@>\dimen\tw@
\global\dimen\tw@\dp\count@ \fi
\mc@col@status@write
\box\count@
\kern2pt %
{\columnseprulecolor\vrule\@width\columnseprule}%
\hss
{\columnseprulecolor\vrule \@width\columnseprule}%
\kern2pt}%
\ifdim\dp\mult@rightbox>\dimen\tw@
\global\dimen\tw@\dp\mult@rightbox \fi
\mc@lastcol@status@write
\box\mult@rightbox
}
\LRmulticolcolumns
\makeatother
\settypeblocksize{9.5in}{6.1in}{*}
\setlrmargins{*}{*}{0.85}
\checkandfixthelayout
\usepackage{fontspec} % don't use these in almost all cases ,xltxtra,xunicode}
%\setromanfont[Mapping=tex-text]{Phetsarath OT}
%\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Phetsarath OT}
%\setmonofont[Scale=MatchLowercase]{Phetsarath OT}
\setlength{\headheight}{14pt}
\setlength{\parindent}{0em}
% set up ordinary footnotes
\makeatletter
\def\footnoterule{\kern-3\p@
\hrule \@width \textwidth \kern 2.6\p@}
\makeatother
\renewcommand\thefootnote{\textit{\arabic{footnote}}}
% code to create chapters, verses, and cross references
\ExplSyntaxOn
\int_new:N \crossref_int
\int_new:N \vs_int
\tl_new:N \crossref_tl
% insert a cross reference
\NewDocumentCommand {\crossref} {m}
{
\int_compare:nNnT { \crossref_int } > { 25 }
{
\int_set:Nn \crossref_int { 0 }
}
\int_incr:N \crossref_int
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \textsuperscript{ \emph { \int_to_alph:n { \crossref_int } } }
\tl_if_empty:NF \crossref_tl
{
\tl_gput_right:Nn \emph { \crossref_tl { ~ } }
}
\tl_gput_right:Nx \crossref_tl
{
% PROVIDES SUPERSCRIPTS FOR REFERENCES
% \exp_not:N \textsuperscript
% {
% \exp_not:N \emph { \int_to_alph:n { \crossref_int } }
% }
\, #1
}
}
%Sample output
% insert chapter marker
\NewDocumentCommand {\ch} {m}
{
\int_gset:Nn \vs_int {1}
\lettrine [findent=0.5em,nindent=0em] { #1 } {}
}
% output cross references from previous verse and insert verse marker
\NewDocumentCommand {\vs} {m}
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
\int_gset:Nn \vs_int { #1 }
\tl_gclear:N \crossref_tl
%\textsuperscript { #1 \, }
%\textbf { #1 \, }
\par\textbf{\large{\textsuperscript{#1 \, }}}
}
% output any remaining cross references
\AtEndDocument
{
\tl_if_empty:NF \crossref_tl
{
\sidebar
{
\textbf { \int_use:N \vs_int } \, \tl_use:N \crossref_tl
}
}
}
\ExplSyntaxOff
% set up centre column location and size
\setlength\columnsep{2.2cm}
\setlength{\sidebarhsep}{\dimexpr -0.5\textwidth - 0.5\columnsep + 2mm}
\setlength{\sidebarwidth}{\dimexpr \columnsep - 4mm}
\sidebarmargin{left}
\renewcommand{\sidebarfont}{\footnotesize\normalfont}
\renewcommand*{\sidebarform}{\raggedright\hangindent 1mm}
\setlength{\sidebarvsep}{0ex}
\setsidebarheight{\dimexpr \textheight - 1ex}
\begin{document}
\begin{multicols}{2}
\ch{1}\crossref{John\ 1:1; [Col.\ 1:17; 1 John 1:1; Rev. 1:4, 8, 17; 3:14;
21:6; 22:13]}In the beginning was \crossref{Rev.\ 19:13; [Heb.\ 4:12; 1 John
1:1]}the Word, and \crossref{1 John 1:2; [ch.\ 17:5]}the Word was with God,
and \crossref{Phil.\ 2:6}the Word was God. \vs{2}He was in the beginning
with God. \vs{3}\crossref{ver.\ 10; Ps.\ 33:6; 1 Cor.\ 8:6; Col.\ 1:16;
Heb.\ 1:2}All things were made through him, and without him was not any
thing made that was made. \vs{4}\crossref{ch.\ 5:26; 11:25; 1 John 1:2;
5:11}In him was life,\footnote{Or \emph{was not any thing made. That which
has been made was life in him}} and \crossref{ch.\ 8:12; 9:5; 12:46}the life
was the light of men. \vs{5}\crossref{[ch.\ 3:19]}The light shines in the
darkness, and the darkness has not overcome it.
\end{multicols}
[REST OF DOCUMENT TRUNCATED]
\end{document}