我正在尝试自定义包的合唱songs
,但我不明白为什么第一行没有正确对齐。R应与诗句编号位于同一位置(1.)。
我过去常常xpatch
删除所有出现的\SB@cbarshift
和\cbarwidth
。然后调整合唱部分,使其格式与主歌相同。
\documentclass[a4paper]{report}
\usepackage[left=2.5cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage[bookmarks,pdfborder={0 0 0}]{hyperref}
\usepackage[chorded,noshading]{songs}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{xpatch}
\songcolumns{1}
\setlength{\parindent}{0pt}
\makeatletter
\xpatchcmd{\justifyleft}
{\SB@cbarshift}
{\ifSB@inchorus\advance\leftskip\versenumwidth\fi}
{}{}
\xpatchcmd{\justifycenter}
{\SB@cbarshift}{}
{}{}
\xpatchcmd{\SB@par}
{\ifdim\cbarwidth>\z@\nobreak\else\SB@ilpenalty\fi}{}
{}{}
\xpatchcmd{\brk}
{
\ifdim\cbarwidth=\z@%
\ifrepchorus\marks\SB@cmarkclass{}\fi%
\SB@breakpoint\brkpenalty%
}
{
\endgroup\egroup
\ifrepchorus\ifSB@gotchorus\else
\global\setbox\SB@chorusbox\vbox{
\unvbox\SB@chorusbox
\SB@chorusbar\SB@box
\unvcopy\SB@box
\SB@breakpoint\brkpenalty
}%
\fi
}
{}{}
\xpatchcmd{\beginchorus}
{\vnumberedfalse}{\vnumberedtrue}
{}{}
\xpatchcmd{\SB@@beginchorus}
{
\setbox\SB@box\vbox\bgroup\begingroup%
\ifchorded%
\def\SB@everypar{%
\vrule\@height\baselineskip\@width\z@\@depth\z@%
\gdef\SB@everypar{}%
}%
\everypar{\SB@everypar\everypar{}}%
\fi%
}
{
\setbox\SB@box\vbox\bgroup\begingroup
\ifvnumbered
\def\SB@everypar{
\setbox\SB@box\hbox{R}
\ifdim\wd\SB@box<\versenumwidth
\setbox\SB@box
\hbox to\versenumwidth{\unhbox\SB@box\hfil}
\fi
\ifchorded\vrule\@height\baselineskip\@width\z@\@depth\z@\fi
\placeversenum\SB@box
\gdef\SB@everypar{}
}
\else
\def\SB@everypar{
\ifchorded\vrule\@height\baselineskip\@width\z@\@depth\z@\fi
\gdef\SB@everypar{}
}
\fi
\everypar{\SB@everypar\everypar{}}
}
{}{}
\xpatchcmd{\SB@endchorus}
{\SB@chorusbar\SB@box}{}
{}{}
\makeatother
\begin{document}
\begin{songs}{}
\beginsong{Dämmerung fällt}
\newchords{dfverse}
\newchords{dfchorus}
\beginverse\memorize[dfverse]
\[a]Dämmerung fällt und grauer \[d]Nebel zieht auf, \[G]einsamer Ruf von wilden \[C]Schwänen klingt auf.
\[a]Sitzen wir um das lodernd' \[d]Feuer herum, \[C]fragen uns leise: Warum \[G]zieh'n wir, warum?
\endverse
\beginchorus\memorize[dfchorus]
\[F]Nordwärts steh'n uns're Sterne, \[C]nordwärts, in weiter Ferne, \[a]nordwärts, da suchen wir das \[G]Glück.
\[F]Nordwärts bei Dunkelheiten, \[C]nordwärts durch Einsamkeiten, \[G]nordwärts, für uns gibt's kein Zu\[a]rück.
\endchorus
\endsong
\end{songs}
\end{document}
答案1
%
对于您的特定情况,这是您的补丁中缺少 4 个符号的情况\SB@@beginchorus
。不过说实话,我会%
在行尾添加更多符号,以防止在其他情况下引入杂散空格。
\documentclass[a4paper]{report}
\usepackage[left=2.5cm,right=1cm,top=1cm,bottom=1cm]{geometry}
\usepackage[bookmarks,pdfborder={0 0 0}]{hyperref}
\usepackage[chorded,noshading]{songs}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{xpatch}
\songcolumns{1}
\setlength{\parindent}{0pt}
\makeatletter
\xpatchcmd{\justifyleft}
{\SB@cbarshift}
{\ifSB@inchorus\advance\leftskip\versenumwidth\fi}
{}{}
\xpatchcmd{\justifycenter}
{\SB@cbarshift}{}
{}{}
\xpatchcmd{\SB@par}
{\ifdim\cbarwidth>\z@\nobreak\else\SB@ilpenalty\fi}{}
{}{}
\xpatchcmd{\brk}
{
\ifdim\cbarwidth=\z@%
\ifrepchorus\marks\SB@cmarkclass{}\fi%
\SB@breakpoint\brkpenalty%
}
{
\endgroup\egroup
\ifrepchorus\ifSB@gotchorus\else
\global\setbox\SB@chorusbox\vbox{
\unvbox\SB@chorusbox
\SB@chorusbar\SB@box
\unvcopy\SB@box
\SB@breakpoint\brkpenalty
}%
\fi
}
{}{}
\xpatchcmd{\beginchorus}
{\vnumberedfalse}{\vnumberedtrue}
{}{}
\xpatchcmd{\SB@@beginchorus}
{
\setbox\SB@box\vbox\bgroup\begingroup%
\ifchorded%
\def\SB@everypar{%
\vrule\@height\baselineskip\@width\z@\@depth\z@%
\gdef\SB@everypar{}%
}%
\everypar{\SB@everypar\everypar{}}%
\fi%
}
{
\setbox\SB@box\vbox\bgroup\begingroup
\ifvnumbered
\def\SB@everypar{%
\setbox\SB@box\hbox{R}%
\ifdim\wd\SB@box<\versenumwidth
\setbox\SB@box
\hbox to\versenumwidth{\unhbox\SB@box\hfil}%
\fi
\ifchorded\vrule\@height\baselineskip\@width\z@\@depth\z@\fi
\placeversenum\SB@box
\gdef\SB@everypar{}%
}
\else
\def\SB@everypar{
\ifchorded\vrule\@height\baselineskip\@width\z@\@depth\z@\fi
\gdef\SB@everypar{}
}
\fi
\everypar{\SB@everypar\everypar{}}
}
{}{}
\xpatchcmd{\SB@endchorus}
{\SB@chorusbar\SB@box}{}
{}{}
\makeatother
\begin{document}
\begin{songs}{}
\beginsong{Dämmerung fällt}
\newchords{dfverse}
\newchords{dfchorus}
\beginverse\memorize[dfverse]
\[a]Dämmerung fällt und grauer \[d]Nebel zieht auf, \[G]einsamer Ruf von wilden \[C]Schwänen klingt auf.
\[a]Sitzen wir um das lodernd' \[d]Feuer herum, \[C]fragen uns leise: Warum \[G]zieh'n wir, warum?
\endverse
\beginchorus\memorize[dfchorus]
\[F]Nordwärts steh'n uns're Sterne, \[C]nordwärts, in weiter Ferne, \[a]nordwärts, da suchen wir das \[G]Glück.
\[F]Nordwärts bei Dunkelheiten, \[C]nordwärts durch Einsamkeiten, \[G]nordwärts, für uns gibt's kein Zu\[a]rück.
\endchorus
\endsong
\end{songs}
\end{document}