LaTeX 和弦制作

LaTeX 和弦制作

我正在制作一本尤克里里琴歌本,我使用这段代码让和弦高于文本。但它会在单词前留出一个小空间(当你把和弦放在上面时)。你知道如何解决这个问题吗?

\newcommand{\ch}[1]{%
  \makebox[-6pt][c]{%
    \raisebox{22pt}[24pt]{~~{\setlength{}\huge\textbf{#1\hspace{-0.33in}}} }
  }
}

答案1

\documentclass{article}

\makeatletter
\newcommand{\ch}[1]{%
  \leavevmode\@bsphack
  \raisebox{2ex}{\makebox[0pt][l]{\small\bfseries\strut#1}}\nolinebreak
  \@esphack
}
\makeatother

\begin{document}

\begin{verse}
\ch{G}.. Mamma take this \ch{D}badge from \ch{Am7}me\\
\ch{G}.. I can't use\ch{D} it any \ch{C}more\\
\ch{G}.. It's getting \ch{D}dark, too dark to \ch{Am7}see\\
\ch{G}.. Feels like I'm \ch{D}knocking on heaven's \ch{C}door\\
\end{verse}

\end{document}

在此处输入图片描述

答案2

如果有人想弹奏简单的和弦,这里有命令,

\newcommand{\ch}[1]{%
  \makebox[-6pt][c]{%
    \raisebox{22pt}[24pt]{~~{\huge\textbf{#1\hspace{-0.33in}}} }
  }
}

那么如果你写一首这样的歌:

\ch{G}.. Mamma take this \ch{D}badge from \ch{Am7}me\\
\ch{G}.. I can't use\ch{D} it any \ch{C}more\\
\ch{G}.. It's getting \ch{D}dark, too dark to \ch{Am7}see\\
\ch{G}.. Feeles like I'm \ch{D}knocking on heaven's \ch{C}door\\

它将产生如下结果:

在此处输入图片描述

相关内容