我正在使用 songs.sourceforge.net 的 songs 包构建歌曲集,并尝试为歌曲创建主题索引。每个小索引占用一整页。我想压缩它们,这样它们就不会占用一整页。
以下是 MWE:
\documentclass[12pt,twoside,titlepage]{article}
\usepackage[top=0.7in, bottom=0.7in, left=1in, right=1in]{geometry}
\usepackage{times}
\title{My MWE}
\usepackage[lyric]{songs}
\newindex{titleidx}{titleidx}
\newauthorindex{authoridx}{authoridx}
\newindex{mytopic}{mytopicidx}
\begin{document}
\songcolumns{1}
\showindex{Title Index}{titleidx}
\showindex{Author Index}{authoridx}
\showindex{My Topic}{mytopic}
\songsection{}
\begin{songs}{titleidx,authoridx}
\beginsong{Just some song}[
by={me},
cr={},
li={}]
\indextitleentry[mytopic]{\songtitle}
\endsong
\end{songs}
\end{document}
答案1
\SB@displayindex
需要重新定义内部宏:
\documentclass[12pt,twoside,titlepage]{article}
\usepackage[top=0.7in, bottom=0.7in, left=1in, right=1in]{geometry}
\usepackage{times}
\title{My MWE}
\usepackage[lyric]{songs}
\newindex{titleidx}{titleidx}
\newauthorindex{authoridx}{authoridx}
\newindex{mytopic}{mytopicidx}
\makeatletter
\renewcommand\SB@displayindex[3]{%
\ifsongindexes\begingroup%
\SB@colwidth\hsize%
\advance\SB@colwidth-#1\columnsep%
\advance\SB@colwidth\columnsep%
\divide\SB@colwidth#1%
\setbox\SB@idxtitlebox\vbox{%
\let\SB@temp\songsection%
\ifx\chapter\undefined\else%
\ifx\chapter\relax\else%
\let\SB@temp\songchapter%
\fi%
\fi%
\SB@temp{#2}%
}%
\IfFileExists{\csname SB@idxfilename@#3\endcsname.sbx}{%
\ifx\hyperlink\undefined\let\hyperlink\@secondoftwo\fi%
\ifx\hyperlink\relax\let\hyperlink\@secondoftwo\fi%
\global\setbox\SB@box\vbox{%
\null%
\vfil%
\unvcopy\SB@idxtitlebox%
\vskip.5in\@minus.3in\relax%
\hbox to\hsize{%
\hfil%
\vbox{%
\hsize\SB@colwidth%
\renewenvironment{idxblock}[1]%
{\begin{SB@smidx}{####1}}{\end{SB@smidx}}%
\let\\\SB@idxitemsep%
\input{\csname SB@idxfilename@#3\endcsname.sbx}%
}%
\hfil%
}%
\vskip\z@\@plus2fil\relax%
}%
{\vbadness\@M\vfuzz\maxdimen%
\splitmaxdepth\maxdepth\splittopskip\z@skip%
\global\setbox\SB@boxii\vsplit\SB@box to\textheight}%
\ifvoid\SB@box%
\box\SB@boxii%
\else%
\global\setbox\SB@box\vbox{%
\renewenvironment{idxblock}[1]%
{\begin{SB@lgidx}{####1}}{\end{SB@lgidx}}%
\let\\\SB@idxitemsep%
\SB@idxsetup{#1}%
\input{\csname SB@idxfilename@#3\endcsname.sbx}%
\unskip%
}%
\SB@toks{\SB@makeidxcolumn{#1}}%
\SB@cnt#1\relax%
\loop\ifnum\SB@cnt>\@ne%
\SB@toks\expandafter{\the\SB@toks%
\kern\columnsep\SB@makeidxcolumn{#1}}%
\advance\SB@cnt\m@ne%
\repeat%
\edef\SB@oneidxpage{\the\SB@toks}%
\unvbox\SB@idxtitlebox%
\vskip.2in\relax%
\nointerlineskip%
\null%
\nointerlineskip%
\SB@cnt\vbadness\vbadness\@M%
\SB@dimenii\vfuzz\vfuzz\maxdimen%
\loop%
\SB@dimen\textheight%
\ifinner\else\kern\z@\advance\SB@dimen-\pagetotal\fi%
\global\setbox\SB@boxii\copy\SB@box%
\global\setbox\SB@boxiii\hbox{\SB@oneidxpage}%
\ifdim\ht\SB@box>\z@%
\box\SB@boxiii%
\vfil\break%
\repeat%
\SB@dimenii\ht\SB@boxii%
\divide\SB@dimenii#1\relax%
\SB@maxmin\SB@dimen>\SB@dimenii%
\loop%
\global\setbox\SB@box\copy\SB@boxii%
\global\setbox\SB@boxiii\hbox{\SB@oneidxpage}%
\ifdim\ht\SB@box>\z@%
\advance\SB@dimen\p@%
\repeat%
\box\SB@boxiii%
\global\setbox\SB@boxii\box\voidb@x%
\vbadness\SB@cnt\vfuzz\SB@dimenii%
\fi%
}%
{%
\vbox{%Changed
\vfil%
\unvbox\SB@idxtitlebox%
\vskip1em\relax%
\hbox to\hsize{\hfil[Index not yet generated.]\hfil}%
\vskip2em\@plus2fil\relax%Changed
}%
}%
%\clearpage%Changed
\endgroup\fi%
}
\makeatother
\begin{document}
\songcolumns{1}
\showindex{Title Index}{titleidx}
\showindex{Author Index}{authoridx}
\showindex{My Topic}{mytopic}
\clearpage
\songsection{}
\begin{songs}{titleidx,authoridx}
\beginsong{Just some song}[
by={me},
cr={},
li={}]
\indextitleentry[mytopic]{\songtitle}
\endsong
\end{songs}
\end{document}
答案2
songs 软件包 2.13 及更高版本包含一个用于此目的的特殊宏。只需将其放入\sepindexesfalse
文档前奏中即可。