3

I create two environments that contains tabular : partitiondanse and nested mesure but i get an error at compilation time:

! Extra }, or forgotten \endgroup.
<template> \unskip \hfil }
                          \hskip \tabcolsep \hskip -.5\arrayrulewidth \vrule...
l.17 \begin{mesure}
                   {l}
\documentclass[a5paper]{article}
\newcounter{countpartition}
\newcounter{countmesure}

\newenvironment{partitiondanse}{%
  \setcounter{countmesure}{0}
  \addtocounter{countpartition}{1}
  \begin{tabular}{l|l}}{\end{tabular}}  

\newenvironment{mesure}{%
  \addtocounter{countmesure}{1}
  \thecountmesure & 
  \begin{tabular}}{\end{tabular}\\}
\begin{document}

\begin{partitiondanse}
\begin{mesure}{l}
1\\
\end{mesure}
\end{partitiondanse}

\end{document}

Can you help me fixing it ?

1 Answer 1

2

The problem here is associated with your insertion of \thecountmesure, followed by &. This leaves \begin{mesure} in one group (the cell before &) and \end{mesure} in another (the cell after &).

Here is a workable solution:

enter image description here

\documentclass{article}

\usepackage{array}

\newcounter{countmesure}

\newenvironment{partitiondanse}{%
  \setcounter{countmesure}{0}%
  \tabular{ >{\stepcounter{countmesure}\thecountmesure~\vrule} l }
}{%
  \endtabular
}

\newenvironment{mesure}[1]{%
  \tabular[t]{#1}
}{%
  \endtabular
}

\begin{document}

\begin{partitiondanse}
  \begin{mesure}{ l }
    abc \\ def
  \end{mesure} \\
  \begin{mesure}{ r }
    ghijkl \\ mnopq
  \end{mesure}
\end{partitiondanse}

\end{document}

You must log in to answer this question.

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