1

I'm using the Songs package and would like to have rounded corners for the song number and center the song number inside the rounded square. I already changed the grey color to orange.

  1. How to customize with rounded corners?
  2. How to vertically and horizontally center the number?

See below my MWE and its output:

\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}

Output of my MWE

Ingmar
  • 6,690
  • 5
  • 26
  • 47
podosta
  • 113

2 Answers2

2

By default this is a simple box, but you can redefine it to use tikz and then use all the tikz options:

\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}

enter image description here

Ulrike Fischer
  • 327,261
  • Great already ! Initially, I would like a rounded rectangle and saw it's possible in Tikz documentation (shape=rounded rectangle). I've tried to update your code but with no success.. Also, I would like to center the number inside, any idea ? – podosta Aug 23 '23 at 20:03
1

Here's my attempt, based on a little booklet I recently did:

\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}

It uses TikZ.

ETA: I have changed the code to produce a rounded rectangle instead of a circle, as requested by OP.

enter image description here

Ingmar
  • 6,690
  • 5
  • 26
  • 47
  • Great already ! Initially, I would like a rounded rectangle and saw it's possible in Tikz documentation (shape=rounded rectangle). I've tried to update your code but with no success.. I've put the same comment in previous solution because i'ts like you have a different approch with using Tkiz. thank ! – podosta Aug 23 '23 at 20:04
  • @podosta: That what you are looking for? I have switched from circles to rounded rectangles. – Ingmar Aug 24 '23 at 05:59
  • defenitivly ! Thank you !! – podosta Aug 24 '23 at 19:07