我想制作一些像歌本一样的东西 - 只有和弦和歌词。我找到了几个软件包,但我还想通过制作自己的命令/环境等来提高我的 TeXing 技能。现在我正在为此苦苦挣扎:例如,我想将和弦放在歌词的某些部分之上。
Gm
Remember when you were young,
Gb Bb
You shone like the sun.
Eb Dm Cm Bb F
Shine on you crazy diamond.
但我不想手动计算数百首歌曲。我希望有一种比计算每两个和弦之间的间距更好的方法,如下所示:
% ... TeX code
Eb\hspace*{XYpt}Dm\hspace*{XYpt}Cm\hspace*{XYpt}Bb\hspace*{XYpt}F
Shine on you crazy diamond.
% .. TeX code
或者:
% .. TeX code
Eb\verb= =Dm\verb= =Cm\verb= =Bb\verb= =F
Shine on you crazy diamond.
% .. TeX code
我很高兴找到如下解决方案:
% .. TeX code
\chord{Eb}Shine\chords{Dm} y\chord{Cm}ou cr\chord{Bb}azy di\chord{F}amond
% .. TeX code
也许看起来更“混乱”,但我认为结果会更精确。一旦我找到这个问题的解决方案,我就会用 C 或 Python 编写一些脚本来格式化歌曲。
答案1
\documentclass{article}
\newcommand\chord[2][l]{%
\makebox[0pt][#1]{\begin{tabular}[b]{@{}l@{}}#2\\\mbox{}\end{tabular}}}
\begin{document}
\chord{Eb}Shine \chord[c]{Dm}on you\chord[r]{Cm} cr\chord{Bb}azy di\chord{F}amond
\end{document}
答案2
代码来自我的其他答案是我的开始leadsheets
该软件包自 2015 年 1 月起出现在 CTAN 和 TeX Live 中(我现在自己也广泛使用它)。
\documentclass{article}
\usepackage{leadsheets}
\definesongtitletemplate{empty}{}
\begin{document}
\begin{song}{title=Nobody Knows You When You're Down And Out}
\begin{verse}
^*{C}O nce I lived the ^{E7}life of a ^*{A7}mil lionaire \\
^{Dmi} Spent all my ^*{A7}mon ey, didn't ^{Dmi}have any cares \\
^{F}Took all my ^{F#dim}friends out for a ^*{C}migh ty good ^{A7}time \\
^{D7} Bought bootleg liquor, ^*{G7}cham pagne and wine
\end{verse}
\end{song}
\setleadsheets{
title-template = empty ,
song-format = \ttfamily ,
chords/sharp = \# ,
chords/flat = b
}
\begin{song}{title=Nobody Knows You When You're Down And Out}
\begin{verse}
^*{C}O nce I lived the ^{E7}life of a ^*{A7}mil lionaire \\
^{Dmi} Spent all my ^*{A7}mon ey, didn't ^{Dmi}have any cares \\
^{F}Took all my ^{F#dim}friends out for a ^*{C}migh ty good ^{A7}time \\
^{D7} Bought bootleg liquor, ^*{G7}cham pagne and wine
\end{verse}
\end{song}
\end{document}
答案3
也存在一个这样的包,可以找到一个例子这里,我从那里偷了一个例子:
\documentclass[letterpaper]{article}
\usepackage[chorded]{songs}
\newindex{titleidx}{cbtitle}
\begin{document}
\begin{songs}{titleidx}
\beginsong{Amazing Grace}[
by={John Newton},
sr={Luke 15:4; 2 Corinthians 4:8,9; Ephesians 2:8; Revelation 14:3},
cr={Public domain.}]
\beginverse
A\[E]mazing \[E/D#]grace! How \[A/C#]sweet the \[E/B]sound
That \[E]saved a \[E/C#]wretch like \[B7]me!
I \[E]once was \[E/D#]lost, but \[A/C#]now am \[E/B]found;
Was \[A]blind, but \[A/B]now I \[E]see.
\endverse
\beginverse
T'was ^grace that ^taught my ^heart to ^fear,
And ^grace my ^fears re^lieved;
How ^precious ^did that ^grace ap^pear
The ^hour I ^first be^lieved!
\endverse
\endsong
\end{songs}
\end{document}
chorded
通过在包选项中 替换 ,您将获得正确的图像lyric
。
答案4
您可以在歌词和和弦模板中输入歌曲,https://patacrep.fr/en/static1/downloads,它是一个使用 latex 的 gui 软件