1

When try to shift vertically a Tikz node that use pgfkeys coordinates it shows an error message: Package pgfkeys Error: I do not know the key '/tikz/10mm)' The basic code is as follow:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{polyglossia}
\setmainlanguage{spanish}
\usepackage{etoolbox}
\usepackage{float} %Paquete para posicionar Tablas
\usepackage{tikz}
\usetikzlibrary{arrows.meta, math}
\usetikzlibrary{tikzmark}
\usetikzlibrary{positioning}
\NewDocumentCommand{\addU}{mm}{\tikz[remember picture]{\node[overlay,above=(of pic cs:#1) ++ (0,10mm)]{#2};}}
\NewDocumentCommand{\addB}{mm}{\tikz[remember picture]{\node[overlay,below=of pic cs:#1]{#2};}}
\usepackage{amsmath}%Para signo igual
\usepackage{musixtex} 
\input {musixfll}
\input {musixper}%percusión

\begin{document}

\begin{music}
    \font\A=phvb8t at 10pt% added for letter type.
      \largemusicsize
      \setlines{1}{5}
      \setclefsymbol{1}{\drumclef}%
      \nobarnumbers
      \nostartrule
      \startextract
      \NOTes\tikzmark{BD}\zql f\tikzmark{R}\doqu m\en
      \znotes\hsk\tikzmark{HH}\doql d\en
      \NOTes\tikzmark{HHH}\zcharnote{16}{\textbf\small \hspace*{-0.08cm} $\circ$}\ibu0m0\doqb0{m}\zcharnote{16}{\textbf\small \hspace*{-0.08cm} $+$}\en
      \NOTes\tbu0\doqb0m\en
      \NOTes\tikzmark{S}\qu j\en
      \NOTes\tikzmark{SR}\dcqu j\en
      \NOTes\tikzmark{C}\roql j\en
      \NOTes\tikzmark{CB}\tgql l\en
      \endextract
\end{music} 
\addU{R}{Ride}
\addU{S}{Snare}
\addU{HHH}{Hi-Hat}
\addB{BD}{Bass Drum}
\addB{HH}{Hi-Hat (foot)}
%\addU{SR}{Snare\\rimshot}
\addU{C}{Clave}
\addU{CB}{Cow Bell}

\end{document}
2
  • The erros is generated on: \NewDocumentCommand{\addU}{mm}{\tikz[remember picture]{\node[overlay,above=(of pic cs:#1) ++ (0,10mm)]{#2};}}
    – ABV
    Mar 19, 2023 at 17:27
  • 1
    The error comes from the , in the value of above. Values with ,, ] and = need to be enclosed in {} so that PGFKeys parses it correctly. Mar 19, 2023 at 18:19

1 Answer 1

1

The positioning library allows you to specify how far above you would like to position something with the syntax above=10mm of nodename

% !TeX TS-program = lualatex

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{polyglossia}
\setmainlanguage{spanish}
\usepackage{etoolbox}
\usepackage{float} %Paquete para posicionar Tablas
\usepackage{tikz}
\usetikzlibrary{arrows.meta, math}
\usetikzlibrary{tikzmark}
\usetikzlibrary{positioning}
\NewDocumentCommand{\addU}{mm}{\tikz[remember picture]{\node[overlay,above=10mm of pic cs:#1]{#2};}}
\NewDocumentCommand{\addB}{mm}{\tikz[remember picture]{\node[overlay,below=of pic cs:#1]{#2};}}
\usepackage{amsmath}%Para signo igual
\usepackage{musixtex} 
\input {musixfll}
\input {musixper}%percusión

\begin{document}

\begin{music}
    \font\A=phvb8t at 10pt% added for letter type.
      \largemusicsize
      \setlines{1}{5}
      \setclefsymbol{1}{\drumclef}%
      \nobarnumbers
      \nostartrule
      \startextract
      \NOTes\tikzmark{BD}\zql f\tikzmark{R}\doqu m\en
      \znotes\hsk\tikzmark{HH}\doql d\en
      \NOTes\tikzmark{HHH}\zcharnote{16}{\textbf\small \hspace*{-0.08cm} $\circ$}\ibu0m0\doqb0{m}\zcharnote{16}{\textbf\small \hspace*{-0.08cm} $+$}\en
      \NOTes\tbu0\doqb0m\en
      \NOTes\tikzmark{S}\qu j\en
      \NOTes\tikzmark{SR}\dcqu j\en
      \NOTes\tikzmark{C}\roql j\en
      \NOTes\tikzmark{CB}\tgql l\en
      \endextract
\end{music} 
\addU{R}{Ride}
\addU{S}{Snare}
\addU{HHH}{Hi-Hat}
\addB{BD}{Bass Drum}
\addB{HH}{Hi-Hat (foot)}
%\addU{SR}{Snare\\rimshot}
\addU{C}{Clave}
\addU{CB}{Cow Bell}

\end{document}
8
  • Great!!! and how about left o right shift ?
    – ABV
    Mar 19, 2023 at 18:15
  • How about to shift (x, y) position ? Very usefull !!!
    – ABV
    Mar 19, 2023 at 18:18
  • 1
    @ABV Have a look at above left and above right in the tikz manual Mar 19, 2023 at 18:23
  • 1
    @ABV If you need more fine control, you could use the calc library and do something like \NewDocumentCommand{\addU}{mm}{\tikz[remember picture]{\node[overlay] at ($(pic cs:#1)+(1cm,2cm)$) {#2};}} Mar 19, 2023 at 18:44
  • 1
    @ABV If you have a new question, ask a new question Mar 19, 2023 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .