![曲のパッケージでエラーが発生しました](https://rvso.com/image/399848/%E6%9B%B2%E3%81%AE%E3%83%91%E3%83%83%E3%82%B1%E3%83%BC%E3%82%B8%E3%81%A7%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%8C%E7%99%BA%E7%94%9F%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F.png)
ここでは、曲のパッケージマニュアルからLaTeXコードを引用しました。
\documentclass{article}
\usepackage[chorded]{songs}
\noversenumbers
\begin{document}
\songsection{Worship Songs}
\begin{songs}{}
\beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken}, sr={Revelation 5:13}, cr={Public domain.}]
\beginverse
\[G]Praise God, \[D]from \[Em]Whom \[Bm]all \[Em]bless\[D]ings \[G]flow;
\[G]Praise Him, all \[D]crea\[Em]tures \[C]here \[G]be\[D]low;
\[Em]Praise \[D]Him \[G]a\[D]bove, \[G]ye \[C]heav’n\[D]ly \[Em]host;
\[G]Praise Fa\[Em]ther, \[D]Son, \[Am]and \[G/B G/C]Ho\[D]ly \[G]Ghost.
\[C]A\[G]men.
\endverse
\endsong
\end{songs}
\end{document}
答え1
\usepackage{ifpdf}
の前にを追加することで問題を解決します\usepackage[<options>]{songs}
。
このコードは最近追加された
\IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\ifpdf\SB@pdftrue\fi}{
\ifx\pdfoutput\undefined\else
\ifx\pdfoutput\relax\else
\ifnum\pdfoutput<\@ne\else
\SB@pdftrue
\fi
\fi
\fi
}
これまでは「偽」分岐のみが使用されていました。問題は、「真」分岐が条件文の中に置かれていることです。つまり、定義は次のようになります。
\long\def \IfFileExists#1#2#3{%
\openin\@inputcheck#1 %
\ifeof\@inputcheck
\ifx\input@path\@undefined
\def\reserved@a{#3}%
\else
\def\reserved@a{\@iffileonpath{#1}{#2}{#3}}%
\fi
\else
\closein\@inputcheck
\edef\@filef@und{#1 }%
\def\reserved@a{#2}%
\fi
\reserved@a}
ifpdf.sty
は最近のTeXのフルディストリビューションにすべて含まれているため、\ifeof
テストは偽を返すため、の行は\@iffileonpath{#1}{#2}{#3}
スキップされます。その際、TeXは条件文をメモします。スキップしているため、
\@iffileonpath{ifpdf.sty}{\ifpdf\SB@pdftrue\fi}{...}
はまだ条件として定義されていないため、\fi
は に一致するものと見なされます。\ifx\input@path\@undefined
\ifpdf
作者が(あまり良くない)テストがifpdf.sty
見つからない場合に備えることにこだわるのであれば、コードは次のようにすべきである。
\IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\csname ifpdf\endcsname\SB@pdftrue\csname fi\endcsname}{
\ifx\pdfoutput\undefined\else
\ifx\pdfoutput\relax\else
\ifnum\pdfoutput<\@ne\else
\SB@pdftrue
\fi
\fi
\fi
}