5

I have this code:

\documentclass{standalone}
\usepackage{multirow}
\usepackage{musixtex}
\usepackage{graphicx}

\begin{document}
        \begin{tabular}[c]{|c|c|c|c|c|c|}
  \hline
  Type & Qualification & Notes & Graphie & Nbr de demi-tons & Nbr de
  demi-tons diatonique\\
  \hline
  \multirow{5}{*}{Seconde}  & Majeur & Do~-~Ré &
  \hspace{-100pt}
\scalebox{0.7}{
  \begin{music}
    \nobarnumbers
    \setclef10
    \startextract
      \notes  \qa c \qa d \en
    \endextract
  \end{music}}
  \hspace{-100pt}
                            & 2 & 0\\
  \cline{2-6}
                            & Majeur & Ré~-~Mi &
  \hspace{-100pt}
\scalebox{0.7}{
  \begin{music}
    \nobarnumbers
    \setclef10
    \startextract
      \notes  \qa d \qa e \en
    \endextract
  \end{music}}
  \hspace{-100pt}
                            & 2 & 0\\
  \cline{2-6}
                            & Mineur & Mi~-~Fa &
  \hspace{-100pt}
\scalebox{0.7}{
  \begin{music}
    \nobarnumbers
    \setclef10
    \startextract
      \notes  \qa e \qa f \en
    \endextract
  \end{music}}
  \hspace{-100pt}
                            & 1 & 1\\
  \cline{2-6}
                            & Majeur & Fa~-~Sol &
  \hspace{-100pt}
\scalebox{0.7}{
  \begin{music}
    \nobarnumbers
    \setclef10
    \startextract
      \notes  \qa f \qa g \en
    \endextract
  \end{music}}
  \hspace{-100pt}
                            & 2 & 0\\
  \cline{2-6}
                            & Majeur & Sol~-~La &
  \hspace{-100pt}
\scalebox{0.7}{
  \begin{music}
    \nobarnumbers
    \setclef10
    \startextract
      \notes  \qa g \qa h \en
    \endextract
  \end{music}}
  \hspace{-100pt}
                            & 2 & 0\\
  \hline
        \end{tabular}

\end{document}

Which produce: Table 1

As we can see, in this table, the text is not vertically centered. I see other similar questions, but they always use p{...}, m{...} or b{...} arguments. I tried this and it centers vertically, but it's no more horizontally centered, and the first line has more height.

So, how can I get everything centered horizontally and vertically, while keeping the first line the same size?

6

like this?

enter image description here

with use of the package adjustbox and defining new command for shorter code:

\documentclass[margin=3mm]{standalone}

\usepackage{multirow}
\usepackage{musixtex}
\usepackage{adjustbox}
\newcommand\MusiC[1]{\adjustbox{trim=145pt 0pt 140pt 0pt, valign=c}%
            {\begin{music}
                \nobarnumbers
                \setclef10
                \startextract
                  \notes  #1
                \endextract
              \end{music}}
                    }


\begin{document}
        \begin{tabular}{|c|c|c|c|c|c|}
  \hline
  Type & Qualification & Notes & Graphie & Nbr de demi-tons & Nbr de
  demi-tons diatonique\\
  \hline
\multirow{18}{*}{Seconde}
    & Majeur    & Do~-~Ré   & \MusiC{\qa c \qa d \en} & 2 & 0\\
    \cline{2-6}
    & Majeur    & Ré~-~Mi   & \MusiC{\qa d \qa e \en} & 2 & 0\\
    \cline{2-6}
    & Mineur    & Mi~-~Fa   & \MusiC{\qa e \qa f \en} & 1 & 1\\
    \cline{2-6}
    & Majeur    & Fa~-~Sol  & \MusiC{\qa f \qa g \en} & 2 & 0\\
  \cline{2-6}
  & Majeur  & Sol~-~La      & \MusiC{\qa g \qa h \en} & 2 & 0\\
  \hline
        \end{tabular}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.