我正在使用该Songs
包,希望歌曲编号有圆角,并将歌曲编号置于圆角正方形内的中心。我已经将灰色改为橙色。
- 如何自定义圆角?
- 如何使数字垂直和水平居中?
请参阅以下我的 MWE 及其输出:
\documentclass{article}
\usepackage[chorded]{songs}
\usepackage{xcolor}
\definecolor{g_songnumbercolor}{RGB}{255, 142, 39}
\renewcommand{\snumbgcolor}{g_songnumbercolor}
\renewcommand{\printsongnum}[1]{\color{white}\bfseries\Huge#1}
\noversenumbers
\setlength{\sbarheight}{0pt}
\begin{document}
\begin{songs}{}
\beginsong{Some song title}[sr={in D}, by={Some other info}]
\beginverse
\[D]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\beginsong{Some song title 2}[sr={in F}, by={Some other info}]
\beginverse
\[F]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\end{songs}
\end{document}
答案1
以下是我的尝试,基于我最近制作的一本小册子:
\documentclass{article}
\usepackage[chorded]{songs}
\usepackage{xcolor,tikz}
\definecolor{g_songnumbercolor}{RGB}{255, 142, 39}
\renewcommand{\snumbgcolor}{white}
\newcommand*\squared[1]{\tikz[baseline=(char.base)]{
\node[shape=rectangle, rounded corners, fill=g_songnumbercolor,draw,line width=1.5pt,inner sep=3pt] (char) {#1};}}
\renewcommand{\printsongnum}[1]{\sffamily\color{white}\bfseries\Huge\squared{#1}}
\noversenumbers
\setlength{\sbarheight}{0pt}
\begin{document}
\begin{songs}{}
\beginsong{Some song title}[sr={in D}, by={Some other info}]
\beginverse
\[D]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\beginsong{Some song title 2}[sr={in F}, by={Some other info}]
\beginverse
\[F]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\end{songs}
\end{document}
它使用 Ti钾Z。
预计到达时间:我已更改代码以生成圆角矩形而不是圆形,这是 OP 的要求。
答案2
默认情况下,这是一个简单的框,但您可以重新定义它以使用 tikz,然后使用所有 tikz 选项:
\documentclass{article}
\usepackage[chorded]{songs}
\usepackage{xcolor}
\definecolor{g_songnumbercolor}{RGB}{255, 142, 39}
\renewcommand{\snumbgcolor}{g_songnumbercolor}
\renewcommand{\printsongnum}[1]{\color{white}\bfseries\Huge#1}
\noversenumbers
\setlength{\sbarheight}{0pt}
\usepackage{tikz}
\makeatletter
\renewcommand\SB@colorbox[2]{\tikz{\node[left color=red,right color=g_songnumbercolor,circle]{#2};}}
\makeatother
\begin{document}
\begin{songs}{}
\beginsong{Some song title}[sr={in D}, by={Some other info}]
\beginverse
\[D]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\beginsong{Some song title 2}[sr={in F}, by={Some other info}]
\beginverse
\[F]Some lyrics
Again \[A]some other lyrics
\endverse
\endsong
\end{songs}
\end{document}